/* 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_mx300N2 lcd(12, 13, 4, 5, 6, 7, 8, 9, 10, 11); uint8_t rows = 2; uint8_t cols = 20; unsigned long count; 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.print("Time passed"); } void loop() { count = millis() / 1000; lcd.clear(); // lcd.autoscroll(); /* // Print each digit, starting at least significant // and shift count one digit lcd.setBigfont(); lcd.setCursor(19, 0); lcd.print(count % 10); // ones count = count / 10; lcd.setCursor(14, 0); lcd.print(count % 10); // tens count = count / 10; lcd.setCursor(9, 0); lcd.print(count % 10); // hundreds count = count / 10; lcd.setCursor(4, 0); lcd.print(count % 10); // thousands */ // Print four consecutive digits anwhere on screen lcd.setBigfont(); lcd.setCursor(random(16), 0); if (count < 1000) lcd.print('0'); if (count < 100) lcd.print('0'); if (count < 10) lcd.print('0'); lcd.print(count % 10000); delay(955); }