Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/alberanid/ticking
- Owner: alberanid
- Created: 2013-03-19T20:49:52.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-03-19T20:50:47.000Z (over 11 years ago)
- Last Synced: 2023-03-23T02:48:01.103Z (over 1 year ago)
- Language: C++
- Size: 105 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.