Hello,
I m pleased to release another multi tasking alternative called SCoop for Simple Cooperative scheduler, for the Arduino and Teensy platforms AVR and ARM, using the yield() standard function.
There are couple of alternatives for doing multi tasking on arduino, including famous RTOS like chibiOS or freeRTOS, but also some light implementation like adOS published on this forum or interrupt driven library like ieOS.
I decided to create this one to bring some user friendly declaration principle and to bring some features I didnt find in other, especiall needed when doing home automation or industrial control, like we find sometime in PLC.
the Version 1 jus released this week end is available on google code here :
https://code.google.com/p/arduino-scoop-cooperative-scheduler-arm-avr/
This pack includes a comprehensive (hopefully) 14 pages user guide and contains 3 standalone libraries.
SCoop.h provides object and macros for easy creating Tasks, Events and Timers.
TimerUp/Down.h provides object class for defining unlimited time counter object with time base handling
IOFilter.h provide objects for declaring and using Input, Output, time filter inputs (extended debounce style)
user guide v1.0 with user and technical info and some performance measurement.
The pack has been tested on Arduino Uno, Teensy++2.0 and Teensy3.0 (beta8) with Arduino IDE v 1.02.
I d be glad if someone could look at it and try it on Arduino DUE as I have not this board myself. just force the definition of MK20DX128 at the begining of SCoop.h
remark : to use it in a final project you might remove the line including "scoopdebug" and removing the SCOOPTRACE definition in the SCoop.h. at the moment it is still included, this gives the possibility to "trace" your code : just use trace("my step one in task1")
just an example:
#include "SCoop.h"
defineTask(myTask1)
void myTask1::setup() { Serial.begin(57600); }
void myTask1::loop() { Serial.println("hello from task");sleep(1000); }
defineTask(myTask2)
void myTask2::setup() { pinMode(13, OUTPUT); }
void myTask2::loop() {
Serial.println("led HIGH");digitalWrite(13, HIGH);sleep(500);
Serial.println("led LOW");digitalWrite(13, LOW);sleep(500); }
void setup() { mySCoop.start(); }
void loop() { Serial.println("do whatever you want here also"); mySCoop.sleep(500); }
got it ?