const int led1 = 2;
const int tombol1 = 3;
const int led2 = 4;
const int tombol2 = 5;
const int led3 = 6;
const int tombol3 = 7;
const int led4 = 8;
const int tombol4 = 9;
int statusTombol1 = 0;
boolean statusLed1 = false;
int statusTombol2 = 1;
boolean statusLed2 = true;
int statusTombol3 = 0;
boolean statusLed3 = false;
int statusTombol4 = 1;
boolean statusLed4 = true;
void setup() {
pinMode(led1, OUTPUT);
pinMode(tombol1, INPUT);
pinMode(led2, OUTPUT);
pinMode(tombol2, INPUT);
pinMode(led3, OUTPUT);
pinMode(tombol3, INPUT);
pinMode(led4, OUTPUT);
pinMode(tombol4, INPUT);
}
void loop() {
statusTombol1 = digitalRead(tombol1);
if(statusTombol1 == HIGH){
statusLed1=!statusLed1;
delay(100);
}
digitalWrite(led1,statusLed1);
statusTombol2 = digitalRead(tombol2);
if(statusTombol2 == HIGH){
statusLed2=!statusLed2;
delay(100);
}
digitalWrite(led2,statusLed2);
statusTombol3 = digitalRead(tombol3);
if(statusTombol3 == HIGH){
statusLed3=!statusLed3;
delay(100);
}
digitalWrite(led3,statusLed3);
statusTombol4 = digitalRead(tombol4);
if(statusTombol4 == HIGH){
statusLed4=!statusLed4;
delay(100);
}
digitalWrite(led4,statusLed4);
}