#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);
const int BUTTON = 18;
int row =0;
byte name0x0[] = { B01100, B00010, B11111, B00010, B11110, B11010, B00010, B00010 };
byte name0x1[] = { B00000, B00000, B11111, B10101, B10101, B11101, B00101, B00101 };
byte name0x2[] = { B00000, B00000, B11111, B00001, B01011, B10101, B10101, B10001 };
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
//pinMode(BUTTON, INPUT);
lcd.init();
lcd.backlight();
lcd.createChar(0, name0x0);
lcd.setCursor(0,0);
lcd.write(0);
lcd.createChar(1, name0x1);
lcd.setCursor(1, 0);
lcd.write(1);
lcd.createChar(2, name0x2);
lcd.setCursor(2, 0);
lcd.write(2);
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}
void loop2() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
if (row >3){
row = 0;
}
print_msg("String data");
if(digitalRead(BUTTON)){
Serial.println("button pressed");
row = row+1;
}
}
void print_msg(String text){
for (int i=0; i<=20-text.length(); i++){
lcd.setCursor(i, row);
lcd.print(text);
delay(200);
lcd.clear();
}
}