Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
21 | jlesech | 1 | /* |
2 | |||
3 | * |
||
4 | * copyleft 2011 snootlab |
||
5 | * free software, have fun ! |
||
6 | * |
||
7 | |||
8 | based on arduino LiquidCrystal Library - TextDirection |
||
9 | |||
10 | Demonstrates the use a 16x2 LCD display. The LiquidCrystal |
||
11 | library works with all LCD displays that are compatible with the |
||
12 | Hitachi HD44780 driver. There are many of them out there, and you |
||
13 | can usually tell them by the 16-pin interface. |
||
14 | |||
15 | This sketch demonstrates how to use leftToRight() and rightToLeft() |
||
16 | to move the cursor. |
||
17 | |||
18 | Library originally added 18 Apr 2008 |
||
19 | by David A. Mellis |
||
20 | library modified 5 Jul 2009 |
||
21 | by Limor Fried (http://www.ladyada.net) |
||
22 | example added 9 Jul 2009 |
||
23 | by Tom Igoe |
||
24 | modified 22 Nov 2010 |
||
25 | by Tom Igoe |
||
26 | |||
27 | This example code is in the public domain. |
||
28 | |||
29 | http://www.arduino.cc/en/Tutorial/LiquidCrystal |
||
30 | |||
31 | */ |
||
32 | |||
33 | // include the library code: |
||
34 | #include <Wire.h> |
||
35 | #include <Deuligne.h> |
||
36 | |||
37 | // initialize the library with the numbers of the interface pins |
||
38 | Deuligne lcd; |
||
39 | |||
40 | int thisChar = 'a'; |
||
41 | |||
42 | void setup() { |
||
43 | Wire.begin(); |
||
44 | // set up the LCD's number of columns and rows: |
||
45 | lcd.init(); |
||
46 | // turn on the cursor: |
||
47 | lcd.cursor(); |
||
48 | Serial.begin(9600); |
||
49 | } |
||
50 | |||
51 | void loop() { |
||
52 | // reverse directions at 'm': |
||
53 | if (thisChar == 'm') { |
||
54 | // go right for the next letter |
||
55 | lcd.rightToLeft(); |
||
56 | } |
||
57 | // reverse again at 's': |
||
58 | if (thisChar == 's') { |
||
59 | // go left for the next letter |
||
60 | lcd.leftToRight(); |
||
61 | } |
||
62 | // reset at 'z': |
||
63 | if (thisChar > 'z') { |
||
64 | // go to (0,0): |
||
65 | lcd.home(); |
||
66 | // start again at 0 |
||
67 | thisChar = 'a'; |
||
68 | } |
||
69 | // print the character |
||
70 | lcd.print(thisChar, BYTE); |
||
71 | // wait a second: |
||
72 | delay(1000); |
||
73 | // increment the letter: |
||
74 | thisChar++; |
||
75 | } |
||
76 | |||
77 | |||
78 | |||
79 | |||
80 | |||
81 | |||
82 | |||
83 |