27
27
by Limor Fried (http://www.ladyada.net)
28
28
example added 9 Jul 2009
29
29
by Tom Igoe
30
+ modified 25 July 2009
31
+ by David A. Mellis
30
32
31
33
http://www.arduino.cc/en/Tutorial/LiquidCrystal
32
34
*/
@@ -40,26 +42,42 @@ LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
40
42
void setup () {
41
43
// set up the LCD's number of rows and columns:
42
44
lcd. begin(16 , 2 );
43
- lcd. setCursor(0 ,7 );
45
+ // lcd.setCursor(0,7);
44
46
// Print a message to the LCD.
45
47
lcd. print(" hello, world!" );
48
+ delay (1000 );
46
49
}
47
50
48
51
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++ ) {
51
55
// scroll one position left:
52
56
lcd. scrollDisplayLeft();
53
57
// wait a bit:
54
- delay (200 );
58
+ delay (150 );
55
59
}
56
60
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++ ) {
59
64
// scroll one position right:
60
65
lcd. scrollDisplayRight();
61
66
// 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 );
63
77
}
78
+
79
+ // delay at the end of the full loop:
80
+ delay (1000 );
81
+
64
82
}
65
83
0 commit comments