#include <Wire.h>
#include <LiquidCrystal_I2C.h>
int button_state = 0;
int cnt=0,trg=0;
LiquidCrystal_I2C LCD = LiquidCrystal_I2C(0x27, 16, 2);
void setup() {
Serial.begin(115200);
LCD.init();
LCD.backlight();
LCD.setCursor(0, 0);
// put your setup code here, to run once:
pinMode(12, OUTPUT);
}
void loop() {
cnt=cnt+1;
if (cnt==1) {trg=1;}
if (cnt >=1000) {cnt=0;}
if (trg==1) {
LCD.clear();
LCD.setCursor(0, 0);
LCD.println("Nama Saya");
LCD.setCursor(0, 1);
LCD.println("M. Izzat Darwisy");
Serial.println("Nama Saya");
Serial.println("M. Izzat Darwisy");
trg=0;}
button_state = digitalRead(15);
if (button_state == HIGH)
{
digitalWrite(12, HIGH);
}
else
{
digitalWrite(12, LOW);
}
}