#define TASTERPIN 8
#define LED_PIN 6
void setup() {
Serial.begin(9600);
pinMode (TASTERPIN, INPUT_PULLUP);
pinMode (LED_PIN, OUTPUT);
}
void loop() {
bool tasterstatus = digitalRead (TASTERPIN);
static bool vorherigerTasterstatus = 1;
static int zaehlwert = 0 ;
digitalWrite(LED_PIN, !tasterstatus);
if (tasterstatus == LOW && vorherigerTasterstatus == HIGH) {
zaehlwert +=1 ;
Serial.print ("Zählwert: ");
Serial.println(zaehlwert);
}
vorherigerTasterstatus = tasterstatus ;
delay (50);
}