//ปริญญา เอี่ยมเพ็ง 652021060
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 8, 10, 11, 9, 13);
#if defined(ARDUINO) && ARDUINO >= 100
#define printByte(args) write(args);
#else
#define printByte(args) print(args,BYTE);
#endif
uint8_t B[8] = {0x0, 0x0, 0x10, 0x10, 0x10, 0x10, 0x18, 0x18};
uint8_t E[8] = {0x0, 0x0, 0x10, 0x10, 0x10, 0x10, 0x18, 0x18};
uint8_t C[8] = {0x0, 0x0, 0x19, 0x19, 0x9, 0x9, 0x9, 0xf};
uint8_t K[8] = {0x0, 0x0, 0x1, 0xe, 0x10, 0x14, 0x1b, 0x11};
uint8_t M[8] = {0x0, 0x0, 0x1f, 0x19, 0x1d, 0x1d, 0x11, 0x11};
void setup() {
pinMode(2, INPUT_PULLUP);
lcd.begin(20, 4);
lcd.createChar(1, B);
lcd.createChar(2, E);
lcd.createChar(3, C);
lcd.createChar(4, K);
lcd.createChar(5, M);
//ชื่อไทย
//lcd.print("\x01");
//lcd.print("\x02");
//lcd.print("\x03");
//lcd.print("\x05");
lcd.setCursor(2, 1);
lcd.print("By Parinya 060");
}
void loop() {
static unsigned long previousMillis = 0;
const long interval = 100;
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
if (digitalRead(2) == LOW) {
static bool showSpecialChars = true;
lcd.clear();
if (showSpecialChars) {
lcd.setCursor(0, 2);
lcd.print("\x01");
lcd.setCursor(1, 2);
lcd.print("\x02");
lcd.setCursor(2, 2);
lcd.print("\x03");
lcd.setCursor(3, 2);
lcd.print("\x05");
lcd.setCursor(2, 1);
lcd.print("\x04");
} else {
lcd.setCursor(1, 2);
lcd.print("Beck");
}
showSpecialChars = !showSpecialChars;
}
}
}