
!
ERROR MESSAGE?
If you see an error message, take a careful look at the
program text you entered. Is it possible that you wrote
something incorrectly? The place where an error leads to
problems in the program text is marked in red in the
Arduino environment (see illustration). In any case, you
should try looking for the actual error first. Even just tiny
typos will lead to error messages! If you cannot find an
error, then take a look at the yellow box below. There,
under the “Opening the sample programs” heading, you
will find an explanation of how you can use the example
programs described in this manual without having to type
them into the computer from scratch.
Typo: “pinnMode” instead of “pinMode!” The
location of the error is highlighted in red.
▶
BlinkOnBoard.ino: In function 'void setup()':
BlinkOnBoard:11: error: 'pinnMode' was not declared in this scope
'pinnMode' was not declared in this scope
'pinnMode' was not declared in this scope
Copy error messages
Did everything work? Great! If so, you will now see a little
green LED — the “onboard LED” — blinking on and off on
the KosmoDuino.
Opening the sample programs
All sample programs can be opened direc
tly, so you can
bypass typing them in by hand. You will f
ind them in the
Arduino environment in this menu:
File
➜
Examples
➜
KosmoBits
EXPLANATION
Now it’s time to really understand the program. Let’s take
a closer look at it.
The first line reads:
int ledPin = 13;
In the Arduino programming language,
instructions must be closed with a
semicolon (“;”).
This defines a variable with the name
ledPin
. Variables
are important components of any program. You can save
any value you like in a variable — numbers, letters, or
entire words. Each variable has a name. The name allows
you to invoke the saved value whenever you like.
If you want to save a value in a variable, use the equals
sign (“=”). The variable goes on the left side of the equals
sign, while the value goes on the right. For example,
int ledPin = 13
means that the value 13 is saved in the
11
PROJECT 1
CodeGamer
CodeGamer manual inside english.indd 11
7/19/16 12:31 PM