Before We Get StartedWhen you open up SparkiDuino there are a couple different menus and buttons that we’re going to take some time to talk about before you start using the program. This way you will feel comfortable with SparkiDuino and you can get started creating fun robotic programs, turning wheels and using sensors.A couple important thinsg to know right off the bat- sometimes people refer to the program you use to create code as an “IDE.” IDE stands for Integrated Development Environment and if you work with robotics or computers a lot you’ll wind up using a bunch of different IDEs. Also, when you write code in SparkiDuino you are creating what is called a “sketch.” The code is called a sketch because it can be written quickly and you wind up writing a sort of outline because SparkiDuino does a lot of the work for you in the background.Here’s what we’ll be covering on this page:
Sparki’s IDE is based on a couple different other softwares. The most common one which you may have seen before is called Arduino. Arduino is used to program a whole bunch of different robotic platforms. Arduino in turn is based on a program called Processing. Processing is used to create all sorts of interesting applications and interfaces by people across the world.All of the software mentioned above is Open Source. Open Source means that anyone can see the code used to write the software and anyone is able to contribute to the project.SparkiDuino allows you to write in a simplified version of the languages C/C++. There are little tools to help you figure things out and a large community based around helping each other learn and explore all sorts of robotics. You’ve taken the first step into the enormous digital world of robotics and coding. Congratulations and have fun!
The MenusAt the top of SparkiDuino there are five menus. Let’s talk about each of those menus briefly.
File- The File menu is where you can do things like save your file, open a saved file or create a new sketch. To open a save file select
“Sketchbook” and find your saved file. There are also a bunch of different sketches in
Examples that you can check out. They are all simple sketches designed to introduce you to different parts of Sparki and writing code.
Upload is the part of SparkiDuino that you will use the most as you learn how to use Sparki. Luckily there’s also a button for Upload which we’ll go over later.
Upload Using Programmer allows you to upload code to other hardware using a sort of translator piece of hardware. I wouldn’t worry about that option for now, if you really get into coding and robotics you’ll come back to it later.
Edit- Edit is pretty standard. It’s where you can
Copy, Paste and do other things like that. The options in this menu that you may not be familiar with is the commenting option.
The Comment/Uncomment option is used to create pieces of code that don’t make the robot do anything but are useful to help out humans reading the code.
Sketch- There are only four options inside this menu so we’ll go over all of them.
The Verify/Compile option allows you to check with the computer to see if there are any errors in your code that the computer can catch. The computer can’t catch all errors, but it does a good job of catching a lot of them.
Show Sketch Folder will pop up the window of the current sketch that is open, wherever you happened to save it in your hard drive.
Add File and
Import Library allow you to add things like libraries (extra pieces of code written by someone else) and other data to your sketches from outside of SparkiDuino.
Tools- Tools is where you can find things like
Board and Serial Port which allow you to pick the type of robot you want to program and where it is plugged into your computer.
There are a couple other options but the only important one is the Serial Monitor. The Serial Monitor allows you to communicate with the robot you have plugged into your computer, which is pretty handy.
Help- This is a really useful menu option. There are a ton of learning tools that you can use in the Help menu to… well… help you. This menu may save you a whole bunch of head scratching if you remember to use it.
The ButtonsLet’s go over the buttons in SparkiDuino.This button compiles your code. That means it checks your code to see if there are any obvious errors in it. It won’t catch all the errors, though!
This button uploads the code you have written onto your robot. It may not upload if you don’t have the correct robot and USB connection selected inside the Tools menu.
This is the button you’ll use the most out of all the buttons in SparkiDuino.This button creates a new sketch.
This button lets you load saved sketches.
This button lets you save your sketch.
This button opens the Serial Monitor.
This button creates a new tab. Tabs are used to divide up your code so you don’t get confused by looking at too much all at once. Tabs also break the code inside the tab out into a different file when you save your sketch. This is useful is you want to use the code elsewhere.
The Coding Area and ConsoleThe coding area is where you’ll actually write your code. Pretty simply, right?
The Console is the area below the coding area, where your error messages will show up.
Now that we’ve talked about the program you’ll be using to learn how to code let’s move on to talk about some code!