Download Print this page

Intel Galileo Hardware Manual page 5

Biobots
Hide thumbs Also See for Galileo:

Advertisement

Hardware
function
These are two functions that are the basic structure of Arduino programming. A
is a piece of code
that does something.
setup
void
The first function is '
'. The word "
" before it just tells you that it doesn't return anything or give
setup
something back. The '
' function is what the microcontroller knows to do first. Anything you put in be-
{ }
tween the first two brackets
will be done first.
loop
loop
set-
The second function is '
'. It also doesn't return anything. The
function happens right after
up
, and runs over and over, until you reset the microcontroller or load a new program.
Without you telling the microcontroller to do something different, it will run:
setup
loop
loop
loop
loop
...
That's how the microcontroller works. If you program something else, it might be different.
//
comments
The sentences that are after the two forward slashes (
) are called
. They are used by the
programmer to remember what they were doing. The microcontroller completely ignores anything after the
two slashes on the same line. It is always good practice to comment in your code, because it is often hard
to remember what you were doing, or other people might need to look at your code and figure out what you
were trying to do.
1.4: Using pinMode
The program that opens up when you start the IDE automatically doesn't do anything. You, the programmer,
has to type something to make things happen. For this example, we want to tell the Galileo to blink the light
emitting diode (LED) that it has on board (Lesson 1, Figure 3).
Lesson 1 Figure 3
Hardware 5

Advertisement

loading