B00000010, B00000100, B00000000,
-
B00000010, B00000100, B00000000,
-
B00000010, B00000100, B00000000,
-
B00000010, B00000100, B00000000,
20
// ...
-
B00000010, B00000100, B00000000, // 5.5
-
B00000111, B11111110, B00000000,
-
B00001111, B11111111, B00000000,
-
B00011111, B11111111, B10000000,
25
B00111111, B11111111, B11000000,
-
B01111111, B11111111, B11100000,
-
B01111111, B11111111, B11100000,
-
B11111111, B11111111, B11110000,
-
B11111111, B11111111, B11110000,
30
B11111111, B11111111, B11110000,
-
B11111111, B11111111, B11110000,
-
B11111111, B11111111, B11110000,
-
B11111111, B11111111, B11110000,
-
B01111111, B11111111, B11100000,
35
B01111111, B11111111, B11100000,
-
B00111111, B11111111, B11000000,
-
B00011111, B11111111, B10000000,
-
B00001111, B11111111, B00000000,
-
B00000111, B11111110, B00000000,
40
B00000001, B11111000, B00000000,
-
B00000001, B11111000, B00000000,
-
};
-
This file looks weird at first, but it’s really simple. First, we include
Arduino.h
because we’ll need to declare binary constants later. After that, we include
avr/pgmspace.h
because we want to store our image data in the Arduino’s flash
RAM. Eventually, we include
thermometer.h
because we need the declaration of
our thermometer image data.
In line 4, we eventually define the
thermometer
variable we declared in
thermome-
ter.h
. The definition differs slightly from the declaration because it contains
the
PROGMEM
directive.
5
This directive tells the compiler to copy the data stored
in the
thermometer
variable to the Arduino’s flash memory. Usually, when you
define a variable in an Arduino program, it occupies memory in the SRAM.
Most Arduinos don’t have a lot of SRAM (the Arduino Uno only has 2 KB), so
it’s a valuable resource and you shouldn’t waste it. As a rule of thumb, you
should store all constant data in the Arduino’s flash RAM. Use SRAM only
for information that might change during program execution.
5.
http://arduino.cc/en/Reference/PROGMEM
Chapter 8. Generating Video Signals with an Arduino • 140
report erratum • discuss
www.it-ebooks.info