// This code should flash the LED every second.
// However the start() function doesnt seem to work
// But resume() does.
// But resume doesn't reset the counter, hence its not possible to restart the
counter from the beginning (time 0)
#include <TimerOne.h>
int state=0;
void setup()
{
pinMode(13, OUTPUT);
Timer1.initialize(1000000); // set a timer of length 100000 microseconds (or 0.1 sec - or 10Hz => the led will blink 5 times, 5 cycles of on-and-off, per second)
Timer1.attachInterrupt( timerIsr ); // attach the service routine here
Timer1.stop();
Timer1.start();
//Timer1.resume();
}
void loop()
{
// Main code loop
// TODO: Put your regular (non-ISR) logic here
}
/// --------------------------
/// Custom ISR Timer Routine
/// --------------------------
void timerIsr()
{
state=state^1;
digitalWrite( 13, state );
}
Original issue reported on code.google.com by synergie7@gmail.com on 28 Nov 2013 at 1:24
Original issue reported on code.google.com by
synergie7@gmail.com
on 28 Nov 2013 at 1:24