#define tombol1 4
#define tombol2 5
#define tombol3 6
#define lampu1 1
#define lampu2 2
#define lampu3 3
#define reset 7
bool lock = false;
void setup() {
pinMode(tombol1, INPUT);
pinMode(tombol2, INPUT);
pinMode(tombol3, INPUT);
pinMode(lampu1, OUTPUT);
pinMode(lampu2, OUTPUT);
pinMode(lampu3, OUTPUT);
pinMode(reset, INPUT);
}
void loop() {
if(lock == false){
if(digitalRead (tombol1) ==HIGH){
digitalWrite(lampu1, HIGH);
lock = true;
}
else if(digitalRead (tombol2) == HIGH){
digitalWrite(lampu2, HIGH);
lock = true;
}
else if(digitalRead (tombol3) == HIGH){
digitalWrite(lampu3, HIGH);
lock = true;
}
}
else{
if(digitalRead (reset) == HIGH){
lock = false;
digitalWrite(lampu1, LOW);
digitalWrite(lampu2, LOW);
digitalWrite(lampu3, LOW);
delay(200);
}
}
}