-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
80 lines (65 loc) · 1.68 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
The I2C LCD/Keypad Backpack is an attempt to get both an LCD and keypad hooked up to an Arduino without using so many pins. Many thanks go out to @jcrouchley who designed the circuit and wrote the firmware for the ATTINY2313. I've taken it a couple steps further and put it onto a PCB and written an Arduino Library for it.
Sample Code:
#include <Wire.h>
#include <I2CLCD.h>
//initialize the library. I2CLCD lcd = I2CLCD(address, columns, rows);
I2CLCD lcd = I2CLCD(0x12, 20, 4);
void setup(){
//initialize lcd. basically turns backlight on and clears display
lcd.init();
}
void loop(){
//turn backlight off
lcd.backlight(1);
delay(2000);
//turn backlight on
lcd.backlight(0);
delay(2000);
//turn the cursor off
lcd.cursorOff();
lcd.write("Cursor Off");
delay(2000);
lcd.clear();
//turn the cursor back on
lcd.cursorOn();
lcd.write("Cursor On");
delay(2000);
lcd.clear();
//turn the blinking cursor on
lcd.blinkOn();
lcd.write("Blink On");
delay(2000);
lcd.clear();
//turn the blinking cursor off
lcd.blinkOff();
lcd.write("Blink Off");
delay(2000);
lcd.clear();
//move the cursor on the screen. First # is row second is column
lcd.setCursor(2, 8);
lcd.write("Move Cursor");
delay(2000);
lcd.clear();
//turn the display off (but not the backlight! that has to be done separately
lcd.setCursor(0, 0);
lcd.write("Turn Display Off");
delay(2000);
lcd.displayOff();
delay(3000);
lcd.clear();
//turn the display back on
lcd.displayOn();
lcd.write("Turn Display On");
delay(2000);
lcd.clear();
//key the keypad push
lcd.write("Keypad Push: ");
lcd.write(lcd.getKey());
delay(2000);
lcd.clear();
//clear the keypad buffer
lcd.write("Clear Keypad Buffer");
lcd.clearBuffer();
delay(2000);
lcd.clear();
}