Arduino LCD
The Arduino LiquidDisplay library lets you control Hitachi HD44780 compatible LCDs. These are inexpensive displays that are quite common. (I got mine from eBay, $3-5 each). This project uses a 2x16 LCD.
Parts:
- 1 Arduino micro-controller
- 1 HD44780 compatible LCD (2x16)
- 1 solderless bread-board (for prototyping)
- Jumper wires
The LCD can be driven with either 4 or 8 data pins. If using 4, the first 4 pins can be ignored (DB0-DB3). The LiquidDisplay() constructor takes a number of parameters:
LiquidCrystal(rs, rw, enable, d4, d5, d6, d7)
- rs: the Arduino pin that connects to the RS pin on the LCD
- rw: the Arduino pin that connects to the RW pin on the LCD
- enable: the Arduino pin that connects to the E pin on the LCD
- d4-d7: the 4 Arduino pins that connect to DB4-DB7 pins on the LCD
I have it connected as follows:
LCD | Arduino |
1 (GND) | GND |
2 (VDD) | 5v |
3 (VO/Contrast) | GND |
4 (RS) | 2 |
5 (RW) | 3 |
6 (E/enable) | 4 |
11 (DB4) | 9 |
12 (DB5) | 10 |
13 (DB6) | 11 |
14 (DB7) | 12 |
15 (BL1/Backlight1) | 5v |
16 (BL2/Backlight2) | GND |
Code
#include
LiquidCrystal lcd(2,3,4,9,10,11,12);
void setup() {
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("Arduino");
lcd.setCursor(0,1);
lcd.print("Rocks!");
}
void loop() {
delay(5000);
}
For more info, see:
LiquidCrystal Library