Skip to content

Commit 16eaf9a

Browse files
committed
Checked and updated all LiquidCrystal examples
1 parent d48347e commit 16eaf9a

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

libraries/LiquidCrystal/examples/Scroll/Scroll.pde

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
by Limor Fried (http://www.ladyada.net)
2828
example added 9 Jul 2009
2929
by Tom Igoe
30+
modified 25 July 2009
31+
by David A. Mellis
3032
3133
http://www.arduino.cc/en/Tutorial/LiquidCrystal
3234
*/
@@ -40,26 +42,42 @@ LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
4042
void setup() {
4143
// set up the LCD's number of rows and columns:
4244
lcd.begin(16, 2);
43-
lcd.setCursor(0,7);
45+
//lcd.setCursor(0,7);
4446
// Print a message to the LCD.
4547
lcd.print("hello, world!");
48+
delay(1000);
4649
}
4750

4851
void loop() {
49-
// scroll 27 positions (display length + string length) to the left:
50-
for (int positionCounter = 0; positionCounter < 27; positionCounter++) {
52+
// scroll 13 positions (string length) to the left
53+
// to move it offscreen left:
54+
for (int positionCounter = 0; positionCounter < 13; positionCounter++) {
5155
// scroll one position left:
5256
lcd.scrollDisplayLeft();
5357
// wait a bit:
54-
delay(200);
58+
delay(150);
5559
}
5660

57-
// scroll 27 positions (display length + string length) to the right:
58-
for (int positionCounter = 0; positionCounter < 27; positionCounter++) {
61+
// scroll 29 positions (string length + display length) to the right
62+
// to move it offscreen right:
63+
for (int positionCounter = 0; positionCounter < 29; positionCounter++) {
5964
// scroll one position right:
6065
lcd.scrollDisplayRight();
6166
// wait a bit:
62-
delay(200);
67+
delay(150);
68+
}
69+
70+
// scroll 16 positions (display length + string length) to the left
71+
// to move it back to center:
72+
for (int positionCounter = 0; positionCounter < 16; positionCounter++) {
73+
// scroll one position left:
74+
lcd.scrollDisplayLeft();
75+
// wait a bit:
76+
delay(150);
6377
}
78+
79+
// delay at the end of the full loop:
80+
delay(1000);
81+
6482
}
6583

0 commit comments

Comments
 (0)