int tombol = 3;
int lampu = 2;
int nilai_tombol;
void setup() {
// put your setup code here, to run once:
pinMode(tombol, INPUT);
pinMode(lampu, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
nilai_tombol = digitalRead(tombol);
if (nilai_tombol == HIGH){
digitalWrite(lampu, HIGH);
delay(500);
digitalWrite(lampu,LOW);
delay(500);
} else{
digitalWrite(lampu, LOW);
}
}