1
SKILL
LEVEL
Ringo Educational Guide Rev04.1 ~ Plum Geek
Code Basics
Let’s cover a few basics...
I know you’re itching to make Ringo do cool stuff, so play with some
of the pre-loaded behaviors for a while. Eventually, you’ll want
to customize how Ringo behaves. For this, you’ll need to learn a
few basics about the code. This guide is not intended to be a complete course in
programming. There are lots of great resources for this (see the end of this section
for some links!) However, we’ll try our best to start you off in the right direction.
Let’s dive right in.
Below you’ll see a box containing code. We’ll use boxes like this throughout the
guide to represent code you’ll write or edit in the Arduino IDE. The important parts
of the code in a given example are highlighted in purple.
/*
Opening Heading. This area includes basic information about the program.
It is not actually loaded onto Ringo. These are just notes for the reader.
*/
#include “RingoHardware.h” //
this makes the IDE include some outside
//
files when loading code into Ringo
void setup(){ //
the setup() function configures Ringo on startup
HardwareBegin(); //
Sets all of Ringo’s I/O pins correctly
otherstuff(); //
there may be other lines of code inside setup()
}
//
this closing curley bracket is the end
//
of the setup() function
void loop(){ //
this is where the real action happens!
commandsToDoStuff(); //
functions inside the loop() function make Ringo
doMoreCoolStuff(); //
do all his cool stuff. You will write most of
evenMoreFun(); //
your code inside the loop() function
}
//
this closing curley bracket is the end
//
of the loop() function