top of page

Hello Jewelbots!

Welcome back, so glad you decided to stop by. Today we are going to learn how to start programing Jewelbots AKA Hello World!!!!!!:):):)

Before we can start coding you need to install and setup Arduino IDE by following the instructions here and here. After everything is setup, go here to create your first program (called a sketch) and learn how to upload it.

Now that you are all set, open up Arduino IDE and create a new sketch!

We are going to write code that will use a timer, buzzer, and LEDs.

Before we start I should mention there are two places where we can put code in a sketch and these are called functions. There are the setup function and the loop function. The setup function means your code will only run once. The loop function means your code will run repetitively without stopping. Today we will use the loop function.

We are going to start with LEDs. An LED is a light emitting diode which the lights inside the Jewelbot are. Put the code below into the loop function.

LED led;

We just created an instance of an LED called led. We can really call it whatever we want, but for the purpose of this post we will stick with led.

Next we want to give a good entrance to our code. Let's start with some magenta lights.

led.turn_on_all(MAGENTA);

We just used led which is our instance from above. Then we called turn_on_all. In parentheses we said MAGENTA in all caps. NOTE. Color only works in CAPS. the code is a sentence telling the Jewelbot what to do. The English translation is turn on all lights as magenta.

PS: The available LED colors are: MAGENTA, CYAN, WHITE, YELLOW, BLUE, and GREEN

Now save your code and upload it to your Jewelbot, here is a screen shot of what uploading should look like.

The next part of our code is to tell the Jewelbot how long to hold the LED lights on magenta. We do this by using a timer instance. Now let's create a timer instance to go under our led one.

Timer timer;

Now that we have defined the timer we can call a function to have the Jewelbot wait. Put the following line after the line where we turned on the led.

timer.pause(5000);

Here we tell the Jewelbot to hold magenta for 5 seconds. Now we want our Jewelbot to buzz. So we are going to use the instance buzzer.

buzzer.short_buzz();

This translates to buzz a short buzz. Using Jewelbots Arduino IDE you also can do the these other buzzes

buzzer.extra_short_buzz(); buzzer.long_buzz(); buzzer.extra_long_buzz(); buzzer.really_long_buzz();

And to finish of our code we turn off our LED.

led.turn_off_all();

Now we string all of our code together so it looks like this:

LED led; Buzzer buzzer; Timer timer;

led.turn_on_all(MAGENTA); timer.pause(5000); buzzer.short_buzz(); led.turn_off_all

YAY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

You just learned how to do some basic Jewelbots coding in Arduino IDE using LEDs, timers, and buzzers. Now try coding yourself. There are lots of fun things you can do with what you know. Go have fun!

From a fellow coder, writer and imaginer -TC:)

You Might Also Like:
bottom of page