#include <TimerOne.h>
#define LED_PIN 2
#define TIMEOUT 4000
#define TASTER_PIN 3
static bool ledState = LOW ;
void toggleLed (){
Timer1.start();
ledState = !ledState; // LED Zustand toggeln
digitalWrite(LED_PIN, ledState);
}
void timeoutISR() {
Timer1.stop ();
}
void setup()
{
pinMode (LED_PIN, OUTPUT);
pinMode (TASTER_PIN, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(TASTER_PIN),toggleLed, CHANGE);
Timer1.initialize(TIMEOUT);
Timer1.attachInterrupt(timeoutISR);
}
void loop () {
}