User manual

018 lcd.print("CNT:");
019 }
020
021 void loop()
022 {
023 lcd.setCursor(5, 1);
024 lcd.print(millis() / 1000);
025 }
In the first line of the program, you can see that operation of
the of the LCD requires integration of the Arduino™ Library with
the name LiquidCrystal.h. It includes the more complex code that
is needed to control the display. You can look in the Ar-
duino™-folder, under Arduino\libraries\LiquidCrystal, and
check out the LiquidCrystal.h and LiquidCrystal.cpp files to get
an idea of the function of the Library. To open these files, it
is recommended to use, e.g., the program Notepad++. You can
download it fre
e of charge from
http://www.notepad-plus-plus.org.
You will see that this Library will do a lot of work for you that
other programmers have already completed. In our Ar-
duino™-program, we integrate only the header file with
LiquidCrystal.h. Arduino™ will now automatically know all LCD
functions.
In the next line, we inform Arduino™ which pins of the LCD are
connected to the Arduino™-PCB.
001 LiquidCrystal lcd(11, 10, 2, 3, 4, 5)
The next command determines the brightness of our display
backlighting. The LED of the LCD is connected to the Arduino™
digital/PWM-port D9. It can be used as a simple digital port or
a PWM (pulse-width modulated port). In our tests, we use it as
a PWM-port. Thus, we can set the brightness of the backlighting
gradually. The value 150 already makes the LED shine sufficiently
brightly. If the PWM-value is chosen lower, the LED will be
darker. Try changing the value and observe what happens.
001 analogWrite(9, 150)
Initialisation is almost completed. Now you need to indicate how
many columns and rows the LCD has: 16 columns/individual
characters and 2 rows.