Skip to content

maisonsmd/msTask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

msTask

This library is based on Paul Stoffregen's TimerOne library that provide ability to add more than one callback, which I called "task"

To use this library, you'll need to install Paul Stoffregen's TimerOne as well:

https://github.com/PaulStoffregen/TimerOne

Usage

Create task:

msTask fooTask(1000, Foo);
msTask barTask(5000, Bar);
  • The first parameter is task's period

  • The second is the callback function:

void Foo(){
	//your Foo task's code here
}

void Bar(){
	//your Bar task's code here
}

Init task

This function must be call in setup() once

msTask::init();

Stop a task

fooTask.stop();

Start a task

fooTask.start();

Change a task's period

fooTask.setPeriod(500);

Change a task's callback

fooTask.setCallback(Bar);

You can read example Blink+AnalogRead, FlashLED or TrafficLight to know how to use.