Back

Sample Code

This sample code is the "Hello World" for your Jewelbots. Copy and paste the sample test code into the Arduino IDE as a new sketch. This makes one of the LEDs on your Jewelbot turn green:

void setup() { // put your setup code here, to run once: } void loop() { // put your main code here, to run repeatedly: LED led; led.turn_on_single(SE, GREEN); }

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 CHANGING THE VARIABLES IN THE “LED.ON(INT, STRING, TIME)” METHOD!

Possible LED positions are NW,NE,SW,SE. The south side being where the USB port is. Possible colors would be RED, GREEN, BLUE, YELLOW, MAGENTA, CYAN, WHITE. These have to be typed in capitals to work.

LEARN MORE ABOUT CODING 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 Arduino Library 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