#include <LiquidCrystal_I2C.h>
bool button, status = 0;
LiquidCrystal_I2C lcd1(0x27, 16, 2);
void setup() {
pinMode(25, INPUT_PULLUP);
pinMode(26, OUTPUT);
lcd1.init();
lcd1.backlight();
Serial.begin(9600);
// put your setup code here, to run once:
}
void loop() {
button = digitalRead(25);
if (button == 0){
status = 1;
}else{
status = 0;
}
digitalWrite(26, status);
lcd1.setCursor (0,0);
if(status == 0){
lcd1.print("Mati");
}else{
lcd1.print("Menyala");
}
lcd1.clear();
// put your main code here, to run repeatedly:
// this speeds up the simulation
}
/*if (button == 0){
digitalWrite(26, 1);
lcd1.setCursor(0,0);
lcd1.print("tombol: ");
lcd1.print("Ditekan");
}else{
digitalWrite(26,0);
lcd1.setCursor(0,0);
lcd1.print("tombol: ");
lcd1.print("Dilepas");
}*/