How to Upload Sparki Code

This guide will show you how to upload new code onto Sparki. Uploading code erases the old code that was on Sparki before, and replaces it with the new code.

You will use SparkiDuino (which is a version of Arduino) to upload code onto Sparki. If you haven’t downloaded SparkiDuino yet click here for the download page.

Warning_TriangleFollowing this example will erase the program that interacts with the remote. Later, if you like, you can restore Sparki’s original program by uploading Examples > Restore_Default.

RestoreSparki

Choose this example code once you are done with this tutorial to restore Sparki’s default code

Once the SparkiDuino software is installed, plug Sparki’s USB cable into your computer’s USB port and Sparki. The smaller end of the USB cable plugs into Sparki while the larger end of the cable plugs into your computer. You cannot program Sparki over the Bluetooth module.

Plug-In Sparki

win_32px If you are using Windows, it may take some time for the drivers to install automatically while Sparki is plugged in. Please be patient.

Select the ArcBotics Sparki board by selecting it from Tools | Board.

You need to select the Sparki board because the SparkiDuino software can talk to a wide variety of hardware. You need to make sure that SparkiDuino “speaks” the type of language that Sparki can understand. (Meaning that SparkiDuino needs to compile the code correctly so that Sparki can use it.)

SparkiDuino_Board

Once you have selected Sparki as the board SparkiDuino is talking to, then select the serial device of the Sparki board from the Tools | Serial Port menu.

You need to select the Serial Port because any time you plug anything into your computer it uses a different Serial Port. If you have a printer, a phone and Sparki all plugged into your computer they will each show up as a different Serial Port. The Port names aren’t anything useful like “Phone,” so you need to figure out which one is Sparki. If you try to upload Sparki code onto your printer it’s definitely not going to work!

SparkiDuino_Serial

ideaIf you’re not sure which Port is Sparki, try looking at the ports in the Serial Port menu before plugging in Sparki, and again after plugging in Sparki. The Port that shows up after you plugged in Sparki should be Sparki. It’s ok to try and upload code to the wrong Serial Port while you figure this step out- you’re not going to destroy anything. The worst things that can happens is that you will get an error message and you need to get comfortable with error messages if you are going to be working with code or robots!

win_32pxOn Windows, this should be something like COM3COM4, or COM5. If you see COM1 and COM2, they are unlikely to be Sparki.

osx_32xOn the Mac, this should be something like/dev/tty.usbmodem1411 for a USB board. Make sure that you select the Port that says “tty” and not “cu.” The “tty” Port is for outgoing information while the “cu” device is for incoming information, such as when Sparki sends information to your computer.

 

So you don’t have to write any code to test your upload we will use one of the examples – the RGB – from the Sparki examples. All example code and code you write upload the same way. This will make Sparki’s RGB LED light up different colors so that you can tell the code upload worked.

Here is an image are selecting the RGB example code. When this RGB code is selected and uploaded, the RGB LED on Sparki will light up first Red, then Green and finally Blue, before starting over with Red.

SparkiDuino_Example

Top - RGB LED

Sparki’s RGB LED

With this code selected, it should show up in the code box now. You can press the second button from the left (the left-pointing arrow). The code will first compile, then upload:

Compile-Uploading

While the code is being uploaded, Sparki’s status light first pulses red while in programming mode, then blinks rapidly while the program is being sent. The LED’s first pulses indicate that code is being passed to Sparki and stored in memory. The LED’s rapid blinking after that indicates that a copy of the code is being sent back to the computer from Sparki to verify that all of the code made it onto Sparki’s memory. Once all of this is done the RGB LED then turns solid red for a moment, then off and then runs the program:

The console then lets you know that it is done uploading:

Done Uploading

Now your Sparki will blink Red, Green then Blue!

Click here for a lesson about programming Sparki’s RGB LED.

If you have trouble, please try a Manual Upload

Now you are ready to start playing with your Sparki! If you already know how to program in C/C++, you may want to go directly to our Robotics Lessons. But if you want to learn the basics of C/C++ and Arduino programming, please visit our Introduction to Programming (Note: C/C++ and Arduino syntax are the tools that we will be using to program the robot). If you are not sure where to start, you can always visit the table of contents to take a general look over all our online material to learn about Sparki and robotics programming.