Skip to content

Commit f34a377

Browse files
committed
Test Script added.
1 parent 269de52 commit f34a377

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#include <Wire.h>
2+
#include <LiquidCrystal_PCF8574.h>
3+
4+
LiquidCrystal_PCF8574 lcd(0x27); // set the LCD address to 0x27 for a 16 chars and 2 line display
5+
6+
int show;
7+
8+
void setup()
9+
{
10+
int error;
11+
12+
Serial.begin(115200);
13+
Serial.println("LCD...");
14+
15+
while (! Serial);
16+
17+
Serial.println("Dose: check for LCD");
18+
19+
// See http://playground.arduino.cc/Main/I2cScanner
20+
Wire.begin();
21+
Wire.beginTransmission(0x27);
22+
error = Wire.endTransmission();
23+
Serial.print("Error: ");
24+
Serial.print(error);
25+
26+
if (error == 0) {
27+
Serial.println(": LCD found.");
28+
29+
} else {
30+
Serial.println(": LCD not found.");
31+
} // if
32+
33+
lcd.begin(16, 2); // initialize the lcd
34+
show = 0;
35+
} // setup()
36+
37+
void loop()
38+
{
39+
if (show == 0) {
40+
lcd.setBacklight(255);
41+
lcd.home(); lcd.clear();
42+
lcd.print("Hello LCD");
43+
delay(1000);
44+
45+
lcd.setBacklight(0);
46+
delay(400);
47+
lcd.setBacklight(255);
48+
49+
} else if (show == 1) {
50+
lcd.clear();
51+
lcd.print("Cursor On");
52+
lcd.cursor();
53+
54+
} else if (show == 2) {
55+
lcd.clear();
56+
lcd.print("Cursor Blink");
57+
lcd.blink();
58+
59+
} else if (show == 3) {
60+
lcd.clear();
61+
lcd.print("Cursor OFF");
62+
lcd.noBlink();
63+
lcd.noCursor();
64+
65+
} else if (show == 4) {
66+
lcd.clear();
67+
lcd.print("Display Off");
68+
lcd.noDisplay();
69+
70+
} else if (show == 5) {
71+
lcd.clear();
72+
lcd.print("Display On");
73+
lcd.display();
74+
75+
} else if (show == 7) {
76+
lcd.clear();
77+
lcd.setCursor(0, 0);
78+
lcd.print("*** first line.");
79+
lcd.setCursor(0, 1);
80+
lcd.print("*** second line.");
81+
82+
} else if (show == 8) {
83+
lcd.scrollDisplayLeft();
84+
} else if (show == 9) {
85+
lcd.scrollDisplayLeft();
86+
} else if (show == 10) {
87+
lcd.scrollDisplayLeft();
88+
} else if (show == 11) {
89+
lcd.scrollDisplayRight();
90+
} // if
91+
92+
delay(2000);
93+
show = (show + 1) % 12;
94+
} // loop()

0 commit comments

Comments
 (0)