Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alberanid/ticking

Arduino library to execute a function every X times some condition has occurred
https://github.com/alberanid/ticking

Last synced: 21 days ago
JSON representation

Arduino library to execute a function every X times some condition has occurred

Awesome Lists containing this project

README

        

Ticking
=======

Sometimes you need to call a function every X times some other condition has occurred; using a Ticking instance, you can define the callback function to be called, the number of cycles at which the function is called. Then, every time the condition occurs, you just have to call the *tick* method.

Example
=======

#include ;

void setup() {
Serial.begin(9600);
}

void cb() {
Serial.println("Callback called!");
}

Ticking ticker(cb, 10);

void loop() {
ticker.tick();
delay(500);
}

Every 10 times the *ticker.tick()* method is called, the *cb()* function is executed.

Author
======

Davide Alberani (C) 2013
http://www.mimante.net/

License
=======

The code is covered by the MIT.