Download Print this page

Intel Galileo Hardware Manual page 6

Biobots
Hide thumbs Also See for Galileo:

Advertisement

Hardware
Before you start programming, you have to know a few things. The Galileo is not very smart, you have
to type very carefully for it to understand what you want it to do. It has trouble with capitalization, as in it
knows what the word 'OUTPUT' means, but not the word 'Output'. It also needs every bracket to match, ev-
{
}
ery '
' needs to have a '
' somewhere. Every line of code inside a function needs to end with a semicolon
;
Guide to Debugging
('
'), or else the Galileo won't know where the line ends. Look a the
for information
on how to avoid and resolve these syntax errors.
pins
The microcontroller interacts with the world by using "
", (Lesson 1 Figure 4) which are the slots labeled
1, 2, 3, ... ,A0, A1, A2,... those are spots where the microcontroller can turn on and off power to, and can read
information from.
Lesson 1 Figure 4
The built-in LED is attached to pin 13. We are going to be outputting to that pin, in other words we are writ-
ing to that pin.
pin-
The way we tell the microcontroller to use Pin 13, the LED, as an output is using a function called "
Mode
". It is used like this:
pinMode(13, OUTPUT);
pinMode
function
is the
name. It means that you should assign some pin a certain mode.
13
OUTPUT
arguments
'
' and '
' are
. They are numbers/words/characters that give the function some in-
formation about what it is going to do. They are separated by a comma, so the microcontroller knows when
one argument stops, and another begins. They are surrounded by parentheses, which tells the microcon-
troller that this is a function, and what things are the arguments.
13
OUTPUT
is the pin number, it can be whatever number pin you want to use.
tells the microcontroller
what you are going to do with the pin. It has to be in all caps, or the microcontroller won't know what it is.
;
The line ends with a semicolon (
), which tells the microcontroller that this line of code is over.
Hardware 6

Advertisement

loading