int buttonPin = 4;
int led = 2;
int buttonStatus = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
//Serial.println("Hello, ESP32!");
pinMode(led, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop() {
buttonStatus = digitalRead(buttonPin);
if (buttonStatus == HIGH){
digitalWrite(led, HIGH);
Serial.println("Lampu Hidup");
}else{
digitalWrite(led, LOW);
Serial.println("Lampu Mati");
}
}