Search wiring.org.co:

Libraries \ TimedAction

Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.

Name |

### TimedAction

Examples |
    #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 = WLED;
    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);
    }
Description | Initialize the TimedAction object and activate it.
Syntax |
    TimedAction( interval, function )
    TimedAction( prev, interval, function)
Methods |

reset() |
enable() |
disable() |
check() |
setInterval() |

Parameters |

prev | The wait time, before starting the interval.
interval | The interval to call the function.
function | the funtion to call each interval.

Returns | None
Usage | Application

Updated on July 07, 2011 11:11:58pm PDT