Libraries \ Scheduler

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.

Class

Scheduler

Name

update()

Examples
#include <Scheduler.h>
//create a scheduler that can schedule 10 function calls at the time
Scheduler <10> scheduler;               

const byte ledPin = WLED;             //LED on onboard led

void setup()
{
  Serial.begin(9600);                 //Initialize the UART
  pinMode(ledPin,OUTPUT);             //set pin 13 to OUTPUT
}

void loop()
{
  //update the scheduler, maybe it is time to execute a function?
  scheduler.update();                 
  
  if (Serial.available())
  {            
	//if we have recieved anything on the Serial
	//schedule a setHigh call in 500 milliseconds
    scheduler.schedule(setHigh,500);  
	//flush Serial so we do not schedule multiple setHigh calls
    Serial.flush();
  }
}

void setHigh()
{
  digitalWrite(ledPin,HIGH);          //set ledPin HIGH
  //schedule setLow to execute in 500 milliseconds
  scheduler.schedule(setLow,500); 
}

void setLow()
{
  digitalWrite(ledPin,LOW);           //set ledPin LOW
}
Description Check to see if it's time to call any of the functions.
Syntax
update()
Returns None
Usage Application
Updated on July 07, 2011 11:11:27pm PDT

Creative Commons License