Add uOLED-96-G1 C Sample Code.
[frickel.git] / projects / geeknamensschilder_c / hardware / libraries / LiquidCrystal / examples / TextDirection / TextDirection.pde
blob725eb0df747640ea10285a731ebc271de8e137eb
1   /*
2   LiquidCrystal Library - TextDirection
3  
4  Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
5  library works with all LCD displays that are compatible with the 
6  Hitachi HD44780 driver. There are many of them out there, and you
7  can usually tell them by the 16-pin interface.
8  
9  This sketch demonstrates how to use leftToRight() and rightToLeft()
10  to move the cursor.
12  The circuit:
13  * LCD RS pin to digital pin 12
14  * LCD Enable pin to digital pin 11
15  * LCD D4 pin to digital pin 5
16  * LCD D5 pin to digital pin 4
17  * LCD D6 pin to digital pin 3
18  * LCD D7 pin to digital pin 2
19  * 10K resistor:
20  * ends to +5V and ground
21  * wiper to LCD VO pin (pin 3)
23  Library originally added 18 Apr 2008
24  by David A. Mellis
25  library modified 5 Jul 2009
26  by Limor Fried (http://www.ladyada.net)
27  example added 9 Jul 2009
28  by Tom Igoe 
29  modified 25 July 2009
30  by David A. Mellis
32  http://www.arduino.cc/en/Tutorial/LiquidCrystal
34  */
36 // include the library code:
37 #include <LiquidCrystal.h>
39 // initialize the library with the numbers of the interface pins
40 LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
42 int thisChar = 'a';
44 void setup() {
45   // set up the LCD's number of rows and columns: 
46   lcd.begin(16, 2);
47   // turn on the cursor:
48   lcd.cursor();
49   Serial.begin(9600);
52 void loop() {
53   // reverse directions at 'm':
54   if (thisChar == 'm') {
55     // go right for the next letter
56     lcd.rightToLeft(); 
57   }
58   // reverse again at 's':
59   if (thisChar == 's') {
60     // go left for the next letter
61     lcd.leftToRight(); 
62   }
63   // reset at 'z':
64   if (thisChar > 'z') {
65     // go to (0,0):
66     lcd.home(); 
67     // start again at 0
68     thisChar = 'a';
69   }
70   // print the character
71   lcd.print(thisChar, BYTE);
72   // wait a second:
73   delay(1000);
74   // increment the letter:
75   thisChar++;