/* * SimpleTimerAlarmExample.pde * * Based on usage example for Time + TimeAlarm libraries * * A timer is called every 15 seconds * Another timer is called once only after 10 seconds * A third timer is called 10 times. * */

#include <SimpleTimer.h>

// There must be one global SimpleTimer object. // More SimpleTimer objects can be created and run, // although there is little point in doing so. SimpleTimer timer;

// function to be called repeatedly void RepeatTask() { Serial.println("15 second timer"); }

// function to be called just once void OnceOnlyTask() { Serial.println("This timer only triggers once"); }

// welcome message Serial.println("SimpleTimer Example"); Serial.println("One timer is triggered every 15 seconds"); Serial.println("Another timer is set to trigger only once after 10 seconds"); Serial.println("Another timer is set to trigger 10 times"); Serial.println();

Create a folder named SimpleTimer in you sketchbook/libraries folder. Copy-n-paste the code for SimpleTimer.h and SimpleTimer.cpp into your favourite text editor, and save those two files under the SimpleTimer folder you just created. Launch or restart the Arduino IDE to let it detect the new library. Copy-n-paste the example code (see below) to get you started with the library.

// constants won't change. They're used here to // set pin numbers:const int buttonPin = 3; // the number of the pushbutton pinconst int ledPin = 13; // the number of the LED pinconst int ledPin2 = 14; // the number of the LED pin// variables will change:int buttonState = 0; // variable for reading the pushbutton status

// constants won't change. They're used here to // set pin numbers:const int buttonPin = 3; // the number of the pushbutton pinconst int ledPin = 13; // the number of the LED pinconst int ledPin2 = 14; // the number of the LED pin// variables will change:int buttonState = 0; // variable for reading the pushbutton status