https://github.com/smfsw/seqtimer
Arduino sequential timer library (multi purpose small lib to handle timers without modifying any hw timer)
https://github.com/smfsw/seqtimer
arduino arduino-library timer
Last synced: about 2 months ago
JSON representation
Arduino sequential timer library (multi purpose small lib to handle timers without modifying any hw timer)
- Host: GitHub
- URL: https://github.com/smfsw/seqtimer
- Owner: SMFSW
- License: bsd-3-clause
- Created: 2015-10-18T20:21:11.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-12-12T19:57:28.000Z (over 7 years ago)
- Last Synced: 2025-02-04T00:33:20.940Z (over 1 year ago)
- Topics: arduino, arduino-library, timer
- Language: C++
- Size: 400 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SeqTimer
[](https://github.com/SMFSW)

[](LICENSE)
[](https://www.codefactor.io/repository/github/smfsw/seqtimer)

[](https://smfsw.github.io/SeqTimer)
[](ReleaseNotes.md)
Arduino sequential timer library (multi purpose small lib to handle timers without modifying any hw timer)
The purpose here is to have a small piece of lib being able to manipulate simple timers (does not modify hw timers).
Keep in mind that this type of timer is not as accurate as a hw timer.
This library is not intended to be used as a PWM generator for example, but to avoid using delay(s).
## Usage
- Automatic class (can handle timers of 2^32 ms max with 1 ms granularity)
- `init(period)` or `setPeriod(period)` if you want to execute the first step right away
- in loop: if `getTimer()` returns `true`, period has elapsed
- Manual class (can handle every uint16 type as time base)
- `init(period, actual time)` to set the period and load the compare register with the given actual time
- in loop: if `getTimer(actual time)` returns `true`, period has elapsed
- possibility to use `reloadTimer(actual time)` to reload compare register manually (finite running counters)
## Examples included
- [SequentialBlink.ino](examples/SequentialBlink/SequentialBlink.ino): a proper way to handle simple timing on a blinking LED
- [CascadingTimers.ino](examples/CascadingTimers/CascadingTimers.ino): a demonstration how to use own base timers & cascading them to obtain a TimeCounter (not to be used as a real RTC)