|
1 | 1 | #include <Wire.h>
|
2 | 2 | #include <LiquidCrystal_I2C.h>
|
3 | 3 |
|
4 |
| -uint8_t bell[8] = {0x4,0xe,0xe,0xe,0x1f,0x0,0x4}; |
5 |
| -uint8_t note[8] = {0x2,0x3,0x2,0xe,0x1e,0xc,0x0}; |
6 |
| -uint8_t clock[8] = {0x0,0xe,0x15,0x17,0x11,0xe,0x0}; |
7 |
| -uint8_t heart[8] = {0x0,0xa,0x1f,0x1f,0xe,0x4,0x0}; |
8 |
| -uint8_t duck[8] = {0x0,0xc,0x1d,0xf,0xf,0x6,0x0}; |
9 |
| -uint8_t check[8] = {0x0,0x1,0x3,0x16,0x1c,0x8,0x0}; |
10 |
| -uint8_t cross[8] = {0x0,0x1b,0xe,0x4,0xe,0x1b,0x0}; |
11 |
| -uint8_t retarrow[8] = { 0x1,0x1,0x5,0x9,0x1f,0x8,0x4}; |
12 |
| - |
13 |
| -LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display |
| 4 | +uint8_t bell[8] = {0x4, 0xe, 0xe, 0xe, 0x1f, 0x0, 0x4}; |
| 5 | +uint8_t note[8] = {0x2, 0x3, 0x2, 0xe, 0x1e, 0xc, 0x0}; |
| 6 | +uint8_t clock[8] = {0x0, 0xe, 0x15, 0x17, 0x11, 0xe, 0x0}; |
| 7 | +uint8_t heart[8] = {0x0, 0xa, 0x1f, 0x1f, 0xe, 0x4, 0x0}; |
| 8 | +uint8_t duck[8] = {0x0, 0xc, 0x1d, 0xf, 0xf, 0x6, 0x0}; |
| 9 | +uint8_t check[8] = {0x0, 0x1 ,0x3, 0x16, 0x1c, 0x8, 0x0}; |
| 10 | +uint8_t cross[8] = {0x0, 0x1b, 0xe, 0x4, 0xe, 0x1b, 0x0}; |
| 11 | +uint8_t retarrow[8] = { 0x1, 0x1, 0x5, 0x9, 0x1f, 0x8, 0x4}; |
| 12 | + |
| 13 | +// Set the LCD address to 0x27 for a 16 chars and 2 line display |
| 14 | +LiquidCrystal_I2C lcd(0x27, 16, 2); |
14 | 15 |
|
15 | 16 | void setup()
|
16 | 17 | {
|
17 |
| - lcd.init(); // initialize the lcd |
18 |
| - lcd.backlight(); |
19 |
| - |
20 |
| - lcd.createChar(0, bell); |
21 |
| - lcd.createChar(1, note); |
22 |
| - lcd.createChar(2, clock); |
23 |
| - lcd.createChar(3, heart); |
24 |
| - lcd.createChar(4, duck); |
25 |
| - lcd.createChar(5, check); |
26 |
| - lcd.createChar(6, cross); |
27 |
| - lcd.createChar(7, retarrow); |
28 |
| - lcd.home(); |
29 |
| - |
30 |
| - lcd.print("Hello world..."); |
31 |
| - lcd.setCursor(0, 1); |
32 |
| - lcd.print(" i "); |
33 |
| - lcd.print(3, BYTE); |
34 |
| - lcd.print(" arduinos!"); |
35 |
| - delay(5000); |
36 |
| - displayKeyCodes(); |
37 |
| - |
| 18 | + lcd.init(); |
| 19 | + lcd.backlight(); |
| 20 | + |
| 21 | + lcd.createChar(0, bell); |
| 22 | + lcd.createChar(1, note); |
| 23 | + lcd.createChar(2, clock); |
| 24 | + lcd.createChar(3, heart); |
| 25 | + lcd.createChar(4, duck); |
| 26 | + lcd.createChar(5, check); |
| 27 | + lcd.createChar(6, cross); |
| 28 | + lcd.createChar(7, retarrow); |
| 29 | + lcd.home(); |
| 30 | + |
| 31 | + lcd.print("Hello world..."); |
| 32 | + lcd.setCursor(0, 1); |
| 33 | + lcd.print(" i "); |
| 34 | + lcd.print(3, BYTE); |
| 35 | + lcd.print(" arduinos!"); |
| 36 | + delay(5000); |
| 37 | + displayKeyCodes(); |
38 | 38 | }
|
39 | 39 |
|
40 | 40 | // display all keycodes
|
41 | 41 | void displayKeyCodes(void) {
|
42 |
| - uint8_t i = 0; |
43 |
| - while (1) { |
44 |
| - lcd.clear(); |
45 |
| - lcd.print("Codes 0x"); lcd.print(i, HEX); |
46 |
| - lcd.print("-0x"); lcd.print(i+16, HEX); |
47 |
| - lcd.setCursor(0, 1); |
48 |
| - for (int j=0; j<16; j++) { |
49 |
| - lcd.print(i+j, BYTE); |
50 |
| - } |
51 |
| - i+=16; |
52 |
| - |
53 |
| - delay(4000); |
54 |
| - } |
| 42 | + uint8_t i = 0; |
| 43 | + |
| 44 | + while (1) { |
| 45 | + lcd.clear(); |
| 46 | + lcd.print("Codes 0x"); |
| 47 | + lcd.print(i, HEX); |
| 48 | + lcd.print("-0x"); |
| 49 | + lcd.print(i + 16, HEX); |
| 50 | + lcd.setCursor(0, 1); |
| 51 | + |
| 52 | + for (int j = 0; j < 16; j++) { |
| 53 | + lcd.print(i + j, BYTE); |
| 54 | + } |
| 55 | + i += 16; |
| 56 | + |
| 57 | + delay(4000); |
| 58 | + } |
55 | 59 | }
|
56 | 60 |
|
57 | 61 | void loop()
|
58 | 62 | {
|
59 |
| - |
| 63 | + // Do nothing here... |
60 | 64 | }
|
61 | 65 |
|
0 commit comments