const int tombol [4] = {2,3,4,5};
const int lampu [4] = {8,9,10,11};
void setup() {
for(int i=0; i<4; i++){
pinMode(lampu[i], OUTPUT);
}
for(int i=0; i<4; i++){
pinMode(tombol[i], INPUT);
}
for(int i=0; i<4; i++){
digitalWrite(tombol[i], HIGH);
}
}
void loop() {
for(int i=0; i<4; i++)
if(digitalRead(tombol[i]) == LOW){
digitalWrite(lampu[i], HIGH);
}
else {
digitalWrite(lampu[i], LOW);
}
}