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(SW, GREEN); }

After pasting the code into Arduino...

1. Plug your Jewelbots into your computer.

We suggest using the original USB cable that came with your Jewelbots.

2. Select the correct Jewelbots Board and Port.

To select a Jewelbots Board: Go to Tools > Boards and scroll down to select "Solo Coding Mode".
To select the port: Go to Tools > Port. Windows should have "COMXX". Mac should have /dev/usberial-xxxx. (The X's representing numbers)

3. Press the magic button for 2 seconds to put your Jewelbots in Uploading Mode

Make sure it is 2 full seconds (1 mississippi...).
You should see a fading of purple lights, which represents the Jewelbots entering Upload Mode.

4. Press the Upload Button on the Arduino IDE

It is the arrow button in the top left.

5. Unplug your Jewelbots to see the results!

When it says "Done Uploading", you can unplug your Jewelbots to see the code in action.
The act of your Jewelbots running custom code is called "Coding Mode".

Test out more code combinations

Try using different colors! (RED, BLUE, GREEN, WHITE, CYAN, YELLOW, MAGENTA)
Try using different animations too!

Share what you code for your Jewelbots

You can post your code creations on the Jewelbots Forums!