int ledpin[] = {8,9,10,11};
int buttonpin[] = {2,3,4,5};
int buttonstate1 = 0;
int buttonstate2 = 0;
int buttonstate3 = 0;
int buttonstate4 = 0;
void setup() {
pinMode(ledpin[0], OUTPUT);
pinMode(buttonpin[0], INPUT);
pinMode(ledpin[1], OUTPUT);
pinMode(buttonpin[1], INPUT);
pinMode(ledpin[2], OUTPUT);
pinMode(buttonpin[2], INPUT);
pinMode(ledpin[3], OUTPUT);
pinMode(buttonpin[3], INPUT);
// put your setup code here, to run once:
}
void loop() {
buttonstate1 = digitalRead(buttonpin[0]);
if (buttonstate1 == HIGH) {
digitalWrite(ledpin[0], HIGH);
}
else {
digitalWrite(ledpin[0], LOW);
}
buttonstate2 = digitalRead(buttonpin[1]);
if (buttonstate2 == HIGH) {
digitalWrite(ledpin[1], HIGH);
}
else {
digitalWrite(ledpin[1], LOW);
}
buttonstate3 = digitalRead(buttonpin[2]);
if (buttonstate3 == HIGH) {
digitalWrite(ledpin[2], HIGH);
}
else {
digitalWrite(ledpin[2], LOW);
}
buttonstate4 = digitalRead(buttonpin[3]);
if (buttonstate4 == HIGH) {
digitalWrite(ledpin[3], HIGH);
}
else {
digitalWrite(ledpin[3], LOW);
}
// put your main code here, to run repeatedly:
}