Sample Code for Friendship

There is a coding sample of how to use Friendship Coding board to do something cool when your Jewelbot sees your red friends. You can change this code to do different things for any and all color friends! Keep in mind that if you were to have code for two different friend colors AND you’re nearby both friend colors, then it will try to do both actions at the same time. This may cause animations to happen in a pattern or the color of the lights to blend.

Animation animation; void setup() { // put your setup code here, to run once } void loop() { //this code means “if see red friends, then do rainbow animations” if (see_red_friends()) { animation.rainbows(); } }

Note that the code for seeing red friends here is in the loop function, which means it will run continuously until you are out of range from red friends (so forever rainbows until you’re a part!!). However, if you want to see how to code an action for when you see the color friends for the FIRST time ONLY, then check out friendship code sample 2!

BEFORE UPLOADING THE CODE, PUT YOUR JEWELBOT INTO UPLOAD MODE BY PLUGGING IN THE USB AND HOLDING THE MAGIC BUTTON DOWN FOR TWO SECONDS. Remember, two full seconds (1 mississippi...) Either the charging light will go out (if you did not update your firmware yet) or your device will flash purple and then fade to indicate that coding mode is activated (if you updated your firmware).

CLICK ON THE UPLOAD BUTTON FROM THE ARDUINO IDE TO TRANSFER THE CODE TO YOUR JEWELBOT.

ONCE THE CODE IS UPLOADED ONTO YOUR JEWELBOT, UNPLUG IT TO SEE THE RESULTS!! The act of your Jewelbot running your code is it being in Coding Mode! (Isn't that cool?!)

TEST OUT MORE CODE COMBINATIONS BY DOING THIS WITH DIFFERENT COLOR FRIEND GROUPS!

SHARE WHAT YOU CODE FOR YOUR JEWELBOT HERE ON THE FORUMS!

Troubleshooting

I'm getting an error I didn't have before?

Try updating your Arduino Library board to make sure you have the most recent coding functions! Go to Tools > Boards > Boards Manager. Search "j" to get the Jewelbots Friendship Coding board. Then hit update!

I'm getting an error that says "failed to execute _main script"

This is an error Mac users get (and we're not sure why yet!), but just ignore it. It doesn't affect how your Jewelbot gets programmed! As long as it says "Device Programmed" or “Upload Complete” at the end, then just unplug your Jewelbot to see the results!

There's an error that says "Possible causes: -boot loader..." etc

Make sure you have the correct Board and Port selected. If you do, then make sure to put your Jewelbot in Upload Mode by pressing it for 2 seconds while plugged in when you hit the upload button.

Getting an error that says error: 'LED' was not declared in this scope

Some suggestions to solve this would be:

If none of these solutions seem to help, then email us at hi@jewelbots.com