Hello,
i wrote a small program with whom I can controll a sound using a switch an a LED,
now I wanna use this programm to controll 2 (for now) LED/switches.
First I thought I could use a switch/case structure, but realized that isnt it.
this is my main loop, currentSwitchState1 is button1, the other will be called currentSwitchState2 and so on,
how can i make the valid for 2-8 switches?
void loop() {
currentSwitchState1 = digitalRead(switchPin1);
currentTimeState = digitalRead(timePin1);
if (currentTimeState == 1) {
currentTime = currentTime + 1000;
}
if (currentSwitchState1 == 1) {
play(currentTime);
aktiv = 1;
buttonCounter++;
} else {
playoff(lastNotePlayed);
buttonCounter = 0;
}
}
cheers