/253-Arduino-Task-Scheduler-Super-Accurate

Finally a task scheduler that is super accurate - good enough for a clock!

Primary LanguageC++MIT LicenseMIT

Video #253 Arduino Task Scheduler (Super-Accurate!)

Finally a task scheduler that is super accurate - good enough for a clock!

Thumbnail-00006 (Phone)

PCBWay One Stop Shopy

During the course of playing about with 7-segment animation, I stumbled across a very well-written Task Scheduler for the Arduino, STM32, ESP32 and others too, from Anatoli Arkhipenko.

I used it just to display a "clock" on the 4-digit, 7-segment display I was using for the animation - and was amazed to find that it was still accurately displaying the correct time the next day. No RTC. No access to the Internet. But still accurate. Unheard of!

Anyone who has ever tried to make an accurate loop in the Arduino environment will know that "drift" is normally unavoidable. That is, the time taken to execute the loop or function has an adverse effect on the timing accuracy of the loop, especially if the loop's code does not always execute the same code. Not any more!

SOFTWARE

So Anatoli Arkhipenko's Task Scheduler is a great find, and has lots of options, not to mention examples. It's worth taking the time to read the documentation to get a better grasp of the potential of this library; not least the option to ensure that a task is effectively guaranteed to fire the correct number of times in a given time period.
Task Scheduler Library Screenshot (Custom)
arkhipenko/TaskScheduler: Cooperative multitasking for Arduino, ESPx, STM32, nRF and other microcontrollers
https://github.com/arkhipenko/TaskScheduler


227 Thumbnail (Custom)
Using printf in an Arduino environment:
https://youtu.be/lhwk5vJ1iMA


*Thumbnail (Custom)
FreeRTOS on an Arduino? No way! Yes way!
https://youtu.be/s57Xr5LsN60

HARDWARE

Two Digit 7-Segment (Custom)
The four-digit 74HC595-controlled device (two 2-digit devices cascaded [soldered] together) can be found here:
https://s.click.aliexpress.com/e/_DEt25OF
They don't make a great clock because the gap between the two sets of two digits is too big, but you could always put a couple of 1.8mm flashing LEDs in there, controlled by another task to ensure they flash accurately every second (just like in the demo sketch). But other ones are available that lend themselves better into making into a clock format.

LINKS

► Clickable list of all my videos (Special thanks to Michael Kurt Vogel for compiling this)
http://bit.ly/YouTubeVideoList-RalphBacon

► If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so and joining me on my Arduinite (and other μControllers) journey

My channel, GitHub and blog are here:
------------------------------------------------------------------
https://www.youtube.com/RalphBacon
https://ralphbacon.blog
https://github.com/RalphBacon
https://buymeacoffee.com/ralphbacon
------------------------------------------------------------------

My ABOUT page with email address: https://www.youtube.com/c/RalphBacon/about