Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 21 | jlesech | 1 | /* |
| 2 | * Smiley |
||
| 3 | * |
||
| 4 | * copyleft 2011 snootlab |
||
| 5 | * free software, have fun ! |
||
| 6 | * |
||
| 7 | * Demo for custom characters on LCD display |
||
| 8 | * Should display a simple :) on top left corner |
||
| 9 | */ |
||
| 10 | |||
| 11 | #include <Wire.h> |
||
| 12 | #include <Deuligne.h> |
||
| 13 | |||
| 14 | Deuligne lcd; |
||
| 15 | |||
| 16 | |||
| 17 | // Custom caracter, 5 significant bits for each byte |
||
| 18 | byte smiley [8]={ |
||
| 19 | B00000, |
||
| 20 | B10001, |
||
| 21 | B00000, |
||
| 22 | B00000, |
||
| 23 | B10001, |
||
| 24 | B01110, |
||
| 25 | B00000 |
||
| 26 | }; |
||
| 27 | |||
| 28 | |||
| 29 | void setup(){ |
||
| 30 | Wire.begin(); |
||
| 31 | lcd.init(); |
||
| 32 | lcd.createChar(0,smiley); |
||
| 33 | lcd.setCursor(0,0); // need to re-position after createChar |
||
| 34 | lcd.write(0); |
||
| 35 | } |
||
| 36 | |||
| 37 | |||
| 38 | void loop(){ |
||
| 39 | // Switch backlight every second |
||
| 40 | lcd.backLight(true); |
||
| 41 | delay(1000); |
||
| 42 | lcd.backLight(false); |
||
| 43 | delay(1000); |
||
| 44 | } |