MsTimer2 is a small and very easy to use library to interface Timer2 with humans. It's called MsTimer2 because it "hardcodes" a resolution of 1 millisecond on timer2.
Updated again:
UPDATED:
License: LGPL
Install it on {arduino-path}/libraries/
// Toggle LED on pin 13 each second
#include <MsTimer2.h>
void flash() {
static boolean output = HIGH;
digitalWrite(13, output);
output = !output;
}
void setup() {
pinMode(13, OUTPUT);
MsTimer2::set(500, flash); // 500ms period
MsTimer2::start();
}
void loop() {
}
send any bug to javiervalencia80 [at] gmail.com