Hardware Reference
In-Depth Information
DisplayingDataontheLCD
Having some parameters in place beforehand makes writing information to the
LCD screen easier. First, use degrees Celsius for the display, and second, assume
that you'll always be showing two digits for the temperature. Once the software
is running, the LCD display will look something like FigureĀ 10.4.
Figure 10-4: LCD display
The "Current:" and "Set:" strings are static; they can be written to the
screen once at the beginning and left there. Similarly, because the temperatures
are assumed to be two digits, you can statically place both " $ C" strings into the
correct locations. The current reading will be displayed in position (8,0) and
will be updated on every run through the loop() . The desired, or set, tempera-
ture will be placed in position (8,1) and updated every time a button is used
to adjust its value. The fan indicator in the lower right of the display will be at
position (15,1) . It should update to reflect the fan's state every time it changes.
The degree symbol, fan off indicator, and fan on indicator are not part of the
LCD character set. Before using them in your sketch, you need to create them as
byte arrays at the beginning of your program, as shown in the following snippet.
//Custom degree character
byte degree[8] = {
B00110,
B01001,
B01001,
B00110,
B00000,
B00000,
B00000,
B00000,
};
Search WWH ::




Custom Search