Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 21 | jlesech | 1 | /* |
| 2 | * Deuligne.h |
||
| 3 | * |
||
| 4 | * copyleft 2011 snootlab |
||
| 5 | * free software, have fun ! |
||
| 6 | * |
||
| 7 | |||
| 8 | based on arduino LiquidCrystal Library |
||
| 9 | - scrollDisplayLeft() and scrollDisplayRight() |
||
| 10 | |||
| 11 | Demonstrates the use a 16x2 LCD display. The LiquidCrystal |
||
| 12 | library works with all LCD displays that are compatible with the |
||
| 13 | Hitachi HD44780 driver. There are many of them out there, and you |
||
| 14 | can usually tell them by the 16-pin interface. |
||
| 15 | |||
| 16 | This sketch prints "Hello World!" to the LCD and uses the |
||
| 17 | scrollDisplayLeft() and scrollDisplayRight() methods to scroll |
||
| 18 | the text. |
||
| 19 | |||
| 20 | Library originally added 18 Apr 2008 |
||
| 21 | by David A. Mellis |
||
| 22 | library modified 5 Jul 2009 |
||
| 23 | by Limor Fried (http://www.ladyada.net) |
||
| 24 | example added 9 Jul 2009 |
||
| 25 | by Tom Igoe |
||
| 26 | modified 22 Nov 2010 |
||
| 27 | by Tom Igoe |
||
| 28 | |||
| 29 | This example code is in the public domain. |
||
| 30 | |||
| 31 | http://www.arduino.cc/en/Tutorial/LiquidCrystal |
||
| 32 | */ |
||
| 33 | |||
| 34 | // include the library code: |
||
| 35 | #include <Wire.h> |
||
| 36 | #include <Deuligne.h> |
||
| 37 | |||
| 38 | // object initialization |
||
| 39 | Deuligne lcd; |
||
| 40 | |||
| 41 | void setup() { |
||
| 42 | Wire.begin(); |
||
| 43 | // set up the LCD's number of columns and rows: |
||
| 44 | lcd.init(); |
||
| 45 | // Print a message to the LCD. |
||
| 46 | lcd.print("hello, world!"); |
||
| 47 | delay(1000); |
||
| 48 | } |
||
| 49 | |||
| 50 | void loop() { |
||
| 51 | // scroll 13 positions (string length) to the left |
||
| 52 | // to move it offscreen left: |
||
| 53 | for (int positionCounter = 0; positionCounter < 13; positionCounter++) { |
||
| 54 | // scroll one position left: |
||
| 55 | lcd.scrollDisplayLeft(); |
||
| 56 | // wait a bit: |
||
| 57 | delay(150); |
||
| 58 | } |
||
| 59 | |||
| 60 | // scroll 29 positions (string length + display length) to the right |
||
| 61 | // to move it offscreen right: |
||
| 62 | for (int positionCounter = 0; positionCounter < 29; positionCounter++) { |
||
| 63 | // scroll one position right: |
||
| 64 | lcd.scrollDisplayRight(); |
||
| 65 | // wait a bit: |
||
| 66 | delay(150); |
||
| 67 | } |
||
| 68 | |||
| 69 | // scroll 16 positions (display length + string length) to the left |
||
| 70 | // to move it back to center: |
||
| 71 | for (int positionCounter = 0; positionCounter < 16; positionCounter++) { |
||
| 72 | // scroll one position left: |
||
| 73 | lcd.scrollDisplayLeft(); |
||
| 74 | // wait a bit: |
||
| 75 | delay(150); |
||
| 76 | } |
||
| 77 | |||
| 78 | // delay at the end of the full loop: |
||
| 79 | delay(1000); |
||
| 80 | |||
| 81 | } |
||
| 82 |