Thanks for the fast answer. Your explanation sounds understandable to me. The callback() function fires one more time and turns on the LED forever.
I tried your fix with the flag register but it didn`t change the situation at all. I also included your statement after Timer.stop() but nothing changed.
#include "TimerOne.h"
volatile bool isBlinking = false;
void setup()
{
//***LED***
pinMode(13, OUTPUT);
//***Timer***
Timer1.initialize(100000);
Timer1.stop();
Timer1.attachInterrupt(callback);
//***Interrupt***
pinMode(2, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(2), blink, FALLING);
}
void callback()
{
digitalWrite(13, !digitalRead(13));
}
void blink()
{
cli();
if (isBlinking == false) {
Timer1.start();
TIFR1 = 0; //clear all Timer 1 Interrupt Flags
isBlinking = true;
}
else { //true
isBlinking = false;
Timer1.stop();
TIFR1 = 0; //clear all Timer 1 Interrupt Flags
digitalWrite(13, LOW);
}
sei();
}
void loop()
{
}
To answer your first question: I use this lib