Libraries
\ Supervisor
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 |
Supervisor |
| Examples |
#include <Supervisor.h>
int x = 0;
SupervisedRule<int> ledOnFirstTenSeconds(x,checkFirstTen,handleAfterTen);
boolean checkFirstTen(int x) {
if (millis()<10000) { return true; } return false;
}
void handleAfterTen(int &x) {
digitalWrite(WLED, LOW);
Supervisor.removeRule(ledOnFirstTenSeconds);
}
void setup()
{
Supervisor.addRule(ledOnFirstTenSeconds);
pinMode(WLED,OUTPUT);
digitalWrite(WLED, HIGH);
}
void loop()
{
Supervisor.checkRules();
}
|
| Description |
Supervise a set of rules that automatically fire a handler for when the rule is broken. Rules operate on a single variable, and need a supporting check function and the beforementioned handler. |
| Syntax |
SupervisedRule < typename > supervisorName(val, check, handle)
|
| Methods |
|
| Parameters |
| typename |
any type |
| supervisorName |
Name of the supervisor |
| val |
Single variable |
| check |
Supporting check function |
| handle |
|
|
| Returns |
None |
| Usage |
Application |
Updated on July 07, 2011 11:11:55pm PDT