#include <LiquidCrystal_I2C.h>
const int led1 = 3;
const int button = 2;
LiquidCrystal_I2C lcd (0x27,16,2);
void setup() {
// put your setup code here, to run once:
pinMode(led1, OUTPUT);
pinMode(button, INPUT);
lcd.begin(16,2);
lcd.init();
lcd.backlight();
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(button) == LOW) {
digitalWrite(led1, HIGH);
lcd.setCursor(0,0);
lcd.print("lampu Hidup");
}
else {
digitalWrite(led1, LOW);
lcd.setCursor(0,1);
lcd.print("lampu Mati");
}
}