//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
byte line_1[8] = {
B00001,
B00001,
B00001,
B00001,
B00001,
B00001,
B00001,
};
byte line_2[8] = {
B00011,
B00011,
B00011,
B00011,
B00011,
B00011,
B00011,
};
byte line_3[8] = {
B00111,
B00111,
B00111,
B00111,
B00111,
B00111,
B00111,
};
byte line_4[8] = {
B01111,
B01111,
B01111,
B01111,
B01111,
B01111,
B01111,
};
byte line_5[8] = {
B11111,
B11111,
B11111,
B11111,
B11111,
B11111,
B11111,
};
void setup()
{
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
//lcd.setCursor(2,0);
//lcd.print("Hello, world!");
//lcd.setCursor(2,1);
//lcd.print("Hello Wokwi!");
}
enum {CHAR_0};
void test() {
lcd.clear();
lcd.createChar(0, line_1);
lcd.createChar(1, line_2);
lcd.createChar(2, line_3);
lcd.createChar(3, line_4);
lcd.createChar(4, line_5);
lcd.setCursor(0,0);
for(int i = 0;i<5);i++ ) {
lcd.write((byte) i);
millis(1000);
}
while(1)
;
lcd.setCursor(0,0);
lcd.write((byte) CHAR_0);
lcd.setCursor(1,0);
lcd.write((byte) CHAR_0);
// // col, row
// //lcd.setCursor(2,0);
// lcd.setCursor(0,0);
// lcd.write('a');
// lcd.setCursor(15, 1);
// lcd.write('b');
// delayMicroseconds(2000); // this is just wrong
while(1);
}
// https://docs.arduino.cc/learn/electronics/lcd-displays
void loop() {
test();
}