/* LiquidCrystal Library - Hello World Demonstrates the use a 20x2 LCD display. The LiquidCrystal library works with all LCD displays that are compatible with the Hitachi HD44780 driver. This sketch prints "Hello World!" to the LCD and shows the time. Library originally added 18 Apr 2008 by David A. Mellis library modified 5 Jul 2009 by Limor Fried (http://www.ladyada.net) example added 9 Jul 2009 by Tom Igoe modified 22 Nov 2010 by Tom Igoe This example code is in the public domain. */ // Include the library code: #include // Initialize the library with the numbers of the interface pins // rs, enable, d0, d1, d2, d3, d4, d5, d6, d7 LiquidCrystal lcd(12, 13, 4, 5, 6, 7, 8, 9, 10, 11); uint8_t rows = 2; uint8_t cols = 20; unsigned long count; // Double height numeric character set byte digitsHi[10][8] = { {0x00, 0x0e, 0x11, 0x11, 0x11, 0x13, 0x13, 0x15}, //0 {0x00, 0x04, 0x0c, 0x1c, 0x04, 0x04, 0x04, 0x04}, //1 {0x00, 0x0e, 0x11, 0x11, 0x01, 0x01, 0x02, 0x02}, //2 {0x00, 0x1f, 0x01, 0x02, 0x02, 0x04, 0x08, 0x0e}, //3 {0x00, 0x10, 0x10, 0x10, 0x14, 0x14, 0x14, 0x1f}, //4 {0x00, 0x1f, 0x11, 0x10, 0x10, 0x10, 0x10, 0x1e}, //5 {0x00, 0x06, 0x04, 0x08, 0x08, 0x10, 0x10, 0x1e}, //6 {0x00, 0x1f, 0x01, 0x01, 0x01, 0x02, 0x02, 0x04}, //7 {0x00, 0x0e, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0e}, //8 {0x00, 0x0e, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0f} //9 }; byte digitsLo[10][8] = { {0x15, 0x19, 0x19, 0x11, 0x11, 0x11, 0x0e, 0x00}, //0 {0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0e, 0x00}, //1 {0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x1f, 0x00}, //2 {0x01, 0x01, 0x01, 0x01, 0x11, 0x11, 0x0e, 0x00}, //3 {0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00}, //4 {0x01, 0x01, 0x01, 0x11, 0x11, 0x11, 0x0e, 0x00}, //5 {0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0e, 0x00}, //6 {0x04, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00}, //7 {0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0e, 0x00}, //8 {0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x00} //9 }; void setup() { // Set up the LCD's number of columns and rows: lcd.begin(cols, rows); // Print a message to the LCD. lcd.print("hello, world!"); delay(1000); lcd.clear(); lcd.setCursor(0, 1); lcd.print("Time passed"); } // Display a double height digit in column specified void doubleHeight(uint8_t n, byte col) { if ((col>=0) & (col < cols) & (n>=0) & (n<10)) { lcd.createChar(col % 4, digitsHi[n]); lcd.createChar(col % 4 +4, digitsLo[n]); lcd.setCursor(col,0); lcd.write(col % 4); lcd.setCursor(col,1); lcd.write(col % 4 +4); } } void loop() { count = millis()/1000; // Print each digit, starting at least significant // and shift count one digit doubleHeight(count % 10, 19); // ones count=count/10; doubleHeight(count % 10, 18); // tens count=count/10; doubleHeight(count % 10, 17); // hundreds count=count/10; doubleHeight(count % 10, 16); // thousands count=count/10; delay(955); }