Thames & Kosmos Code Gamer Experiment Manual page 13

Coding workshop ? game with kosmobits
Table of Contents

Advertisement

PROJECT 1
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.
Did everything work? Great! If so, you will now see a little
green LED — the "onboard LED" — blinking on and off on
the KosmoDuino.
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;
CodeGamer manual inside english.indd 11
Typo: "pinnMode" instead of "pinMode!" The
location of the error is highlighted in red. ▶
'pinnMode' was not declared in this scope
BlinkOnBoard.ino: In function 'void setup()':
BlinkOnBoard:11: error: 'pinnMode' was not declared in this scope
'pinnMode' was not declared in this scope
This defines a variable with the name
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,
means that the value 13 is saved in the
int ledPin = 13
CodeGamer
!
Copy error messages
. Variables
ledPin
11
7/19/16 12:31 PM

Advertisement

Table of Contents
loading

Table of Contents