This example is for Wiring version 1.0 build 0100+. If you have a previous version, use the examples included with your software. If you see any errors or have comments, please let us know.
HelloTimedAction by BREVIG http://alexanderbrevig.com
This sketch will blink an LED at pin 13 each second A simulation of the well known 'blink' sketch without it blocking execution of loop
This sketch will blink an LED at pin 13 each second A simulation of the well known 'blink' sketch without it blocking execution of loop
#include <TimedAction.h> //this initializes a TimedAction class that will change the state of an LED every second. TimedAction timedAction = TimedAction(1000,blink); //pin / state variables const byte ledPin = 13; boolean ledState = false; void setup() { pinMode(ledPin,OUTPUT); digitalWrite(ledPin,ledState); } void loop() { timedAction.check(); //you can add you code here, it will run 'parallel' to the blink } void blink() { ledState ? ledState=false : ledState=true; digitalWrite(ledPin,ledState); }