/* LiquidCrystal Library - Hello World Demonstrates the use a 24x2 serial LCD display with KS0073 LCD driver chip. */ // include the library code: #include // initialize the library with the number of the pins // sclk, mosi, miso (optional), ss) //LiquidCrystal_ks0073 lcd(7,4,6); LiquidCrystal_ks0073 lcd(7, 11, 10); int l; int rows = 2; int cols = 24; // some user defined test characters uint8_t smiley[8] = { B00000, B00000, B10001, B00000, B00000, B10001, B01110, B00000, }; uint8_t one[8] = { B00000, B00000, B00000, B00100, B00000, B00000, B00000, B00000, }; uint8_t two[8] = { B00000, B00000, B01110, B01110, B01110, B00000, B00000, B00000, }; uint8_t three[8] = { B00000, B11111, B11111, B11111, B11111, B11111, B00000, B00000, }; uint8_t four[8] = { B11111, B11111, B11111, B11111, B11111, B11111, B11111, B11111, }; uint8_t five[8] = { B11111, B11111, B11111, B11011, B11111, B11111, B11111, B11111, }; uint8_t six[8] = { B11111, B11111, B10001, B10001, B10001, B11111, B11111, B11111, }; uint8_t seven[8] = { B11111, B10001, B10001, B10001, B10001, B10001, B10001, B11111, }; uint8_t blank[8] = { B00000, B00000, B00000, B00000, B00000, B00000, B00000, B00000, }; void setup() { // set up the LCD's number of columns and rows: lcd.begin(cols, rows); // define some programmable characters (only 4 allowed) lcd.createChar(0, smiley); lcd.createChar(1, one); lcd.createChar(2, two); lcd.createChar(3, three); lcd.createChar(4, four); lcd.createChar(5, five); lcd.createChar(6, six); lcd.createChar(7, seven); lcd.cursor(); lcd.blink(); // Print a message to the LCD. lcd.print("Hello"); delay(1000); lcd.print(", World!"); delay(2000); lcd.clear(); lcd.noCursor(); lcd.noBlink(); lcd.print("The quick brown fox jumps over the lazy "); for (int k = 0; k < 40; k++) { lcd.scrollDisplayLeft(); delay(400); } delay(500); for (int k = 0; k < 40; k++) { lcd.scrollDisplayRight(); delay(400); } delay(2000); lcd.clear(); } void loop() { // display the character set for (int k = 0; k < rows; k++) { for (int j = 0; j < cols; j++) { // animate cursor position /* for (int i = 1; i < 5; i++) { lcd.setCursor(j, k); lcd.write( i ); delay(200); } */ lcd.setCursor(j, k); lcd.write(32); delay(20); lcd.setCursor(j, k); lcd.write(l); l++; // if (l == 128) l = 161; if (l > 255) { // l = 0; delay(2000); break; } } if (l > 255) { l = 0; delay(2000); break; } if (k == (rows - 1)) { delay(2000); lcd.clear(); } if (k > 1) delay(10000); lcd.setCursor(1, 1); } }