const byte pinTaster[] = {3, 4, 5};
int counter[] = {0, 0, 0};
int merkerTaster[] = {0, 1, 2};
int statusTaster[] = {0, 1, 2};
void schalter(int pin) {
statusTaster[pin] = !digitalRead(pinTaster[pin]);
delay(10);// zum entprellen
if (statusTaster[pin] & !merkerTaster[pin]) {
merkerTaster[pin] = true;
counter[pin] ++;
Serial.println (counter[pin]);
}
if (!statusTaster[pin]) {
merkerTaster[pin] = false;
}
}
void setup() {
Serial.begin(9600);
pinMode(pinTaster[0], INPUT_PULLUP);
pinMode(pinTaster[1], INPUT_PULLUP);
pinMode(pinTaster[2], INPUT_PULLUP);
}
void loop() {
schalter(0);
schalter(1);
schalter(2);
}