int pinLed1 = 17 ;
int pinLed2 = 16 ;
int pinTasterUp = 25 ;
int pinTasterDown = 26 ;
int counter = 0 ;
void setup() {
Serial.begin(9600);
pinMode(pinLed1, OUTPUT);
pinMode(pinLed2, OUTPUT);
pinMode(pinTasterUp, INPUT);
pinMode(pinTasterDown, INPUT);
}
void loop() {
bool tasterUpZustand = digitalRead(pinTasterUp);
bool tasterDownZustand = digitalRead(pinTasterDown);
Serial.println(tasterUpZustand);
Serial.println(tasterDownZustand);
if (tasterUpZustand &&! tasterDownZustand) {
counter++;
}
else if (!tasterUpZustand && tasterDownZustand){
counter-- ;
}
Serial.print("Zähler");
Serial.println(counter);
if (counter == 5 ) {
digitalWrite(pinLed1, HIGH);
Serial.println("LED1 AN");
}
else if (counter == 10){
digitalWrite(pinLed2, HIGH);
Serial.println("LED2 AN");
}
else if(counter > 10){
counter = 0;
}
else if (counter == 0){
digitalWrite(pinLed1, LOW);
digitalWrite(pinLed2, LOW);
Serial.println ("LEDs AUS");
}
delay(180);
}