Рет қаралды 20,615
Finally a task scheduler that is super accurate - good enough for a clock!
Ten PCBs for just $5 pcbway.com/
Participate in the 5th PCBWay PCB Design Contest!
Demo sketch, links and more in my GitHub:
github.com/Ral...
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.
Demo sketch, links and more in my GitHub:
github.com/Ral...
► arkhipenko/TaskScheduler: Cooperative multitasking for Arduino, ESPx, STM32 and other microcontrollers
github.com/ark...
► Using "printf" in an Arduino environment:
• #227 ✨printf for Ardui...
► FreeRTOS on an Arduino? No way! Yes way!
• #244 Multiple tasks on...
HARDWARE
The four-digit 74HC595-controlled device (two 2-digit devices cascaded [soldered] together) can be found here:
s.click.aliexp...
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)
bit.ly/KZbinV...
► 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
Demo sketch, links and more in my GitHub:
github.com/Ral...
My channel, GitHub and blog are here:
------------------------------------------------------------------
• / ralphbacon
• ralphbacon.blog
• github.com/Ral...
• buymeacoffee.c...
------------------------------------------------------------------
My ABOUT page with email address: / ralphbacon