After you have chosen the right serial port, click the Verify button, and you
should see the following output in the IDE’s message area (the Arduino IDE
calls programs sketches):
Build options changed, rebuilding all
Sketch uses 1,030 bytes (3%) of program storage space. Maximum is 32,256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for
local variables. Maximum is 2,048 bytes.
This means the IDE has successfully compiled the source code into 1,030
bytes of machine code that we can upload to the Arduino. If you see an error
message instead, check whether you have typed in the program correctly.
(When in doubt, download the code from the book’s website.)
16
Depending on
the Arduino board you’re using, the byte maximum may differ. On an Arduino
Duemilanove, it’s usually 14336, for example. Also, the size of the sketch
might be slightly different depending on the version of the Arduino IDE.
Now click the Upload button, and after a few seconds, you should see the
following output in the message area:
Sketch uses 1,030 bytes (3%) of program storage space. Maximum is 32,256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for
local variables. Maximum is 2,048 bytes.
This is exactly the same message we got after compiling the program, and it
tells us that the 1,030 bytes of machine code were transferred successfully
to the Arduino. In case of any errors, check whether you have selected the
correct Arduino type and the correct serial port in the Tools menu.
During the upload process, the TX and RX LEDs will flicker for a few seconds.
This is normal, and it happens whenever the Arduino and your computer
communicate via the serial port. When the Arduino sends information, it
turns on the TX LED. When it gets some bits, it turns on the RX LED. Because
the communication is pretty fast, the LEDs start to flicker, and you cannot
identify the transmission of a single byte. (If you can, you’re probably an
alien.)
As soon as the code has been transmitted completely, the Arduino executes
it. In our case, this means the status LED starts to blink. It turns on for half
a second, then it turns off for half a second, and so on.
16.
http://www.pragprog.com/titles/msard2
Chapter 1. Welcome to the Arduino • 20
report erratum • discuss
www.it-ebooks.info