elapsedMillis
TaskScheduler
elapsedMillis | TaskScheduler | |
---|---|---|
3 | 5 | |
83 | 1,184 | |
- | - | |
0.0 | 0.0 | |
about 4 years ago | 4 months ago | |
C++ | C++ | |
MIT License | BSD 3-clause "New" or "Revised" License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
elapsedMillis
-
PSA: You're probably using delay() when you want to use millis().
If you're lazy ellapsedMillis also works really well. To my eyes it also results in more easily readable code, I use it a lot.
-
millis() overflow will not hurt you...
I made the same discovery a few years ago, but it still found it distasteful to rely on this wraparound effect. Then I discovered the very cool elapsedMillis library, which provides better functionality/flexibility than millis() and also results in more readable code. I ended up writing an article on how to use this library to implement cooperative multitasking, and I've used this approach on many complex projects since then.
- Want to use EVERY_N_MILLISECONDS function in another non LED project.
TaskScheduler
-
How do you make a code that does like 2 or 3 things simulatneously?
When you get a little more advanced it's not hard to extend the BWD code to hsndle any number of "time when something should happen". Or you can use something like the TaskScheduler library.
-
Understanding the rarely seen EVERY_N_MILLIS_I ?
Or just use TaskScheduler and never have to worry about this again. https://github.com/arkhipenko/TaskScheduler
-
Event-driven architecture
For reference, I'm a big fan of this scheduler in particular, due to it's simplicity, OO support and a neat extra of sleeping each unused millisecond (low power for free).
-
Current consumption between arduino and HAL?
One of my favourite low power techniques involves using a scheduller for your loop code, and sleep for 1 ms at a time when there are no tasks to run. As seen here.
-
Garden irrigation system based on ESP32
Have you looked at the task scheduler library? https://github.com/arkhipenko/TaskScheduler
What are some alternatives?
Arduino-Libs - Arduino Libs & Examples: ADS1147, ADS7846, DAC8760, DS1307, RV8523, MCP2515, WS2812, S65-Display, MI0283QT-2/-9/-11, HX8347D, ILI9341, SSD1331
FastLED_examples - FastLED example code, tests, demos, etc
LoLa - Low Latency Radio System
Adafruit_Sensor - Common sensor library
Arduino-AppleMIDI-Library - Send and receive MIDI messages over Ethernet (rtpMIDI or AppleMIDI)
lcdgfx - Driver for LCD displays running on Arduino/Avr/ESP32/Linux (including Rasperry) platforms
Arduino-USBMIDI - Allows a microcontroller, with native USB capabilities, to appear as a MIDI device over USB to a connected computer
xbox360-flasher - XBOX360 Teensy/RPi Pico flasher
PCF8574_library - PCF8574 library. i2c digital expander for Arduino, Raspberry Pi Pico and rp2040 boards, esp32, SMT32 and ESP8266. Can read write digital values with only 2 wire. Very simple to use and encoder support.
pcd8544 - Minimal footprint library for Philips PCD8544 LCDs on the Arduino.
MDNS_Generic - mDNS Library for nRF52, SAMD21, SAMD51, SAM DUE, STM32F/L/H/G/WB/MP1, AVR Mega, RP2040-based boards, etc. using Ethernet W5x00. Supports mDNS (Registering Services) and DNS-SD (Service Discovery). Ethernet_Generic library is used as default for W5x00
ESP8266_AT_WebServer - This is simple yet complete WebServer library for AVR, Teensy, SAM DUE, SAMD, STM32, nRF52, etc. boards running ESP8266 AT-command shields. The functions are similar and compatible to ESP8266/ESP32 WebServer libraries to make life much easier to port sketches from ESP8266/ESP32. Now with fix of severe limitation to permit sending much larger data