{"id":21014995,"url":"https://github.com/jaakka/delayfunctionsarduino","last_synced_at":"2026-04-13T20:32:50.738Z","repository":{"id":263448429,"uuid":"889017538","full_name":"jaakka/DelayFunctionsArduino","owner":"jaakka","description":"A lightweight Arduino library for managing multiple software timers with non-blocking operation. Ideal for applications like LED blinking, button debouncing, and periodic updates in Arduino and ESP projects.","archived":false,"fork":false,"pushed_at":"2024-11-20T07:26:23.000Z","size":38,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-20T12:06:15.614Z","etag":null,"topics":["arduino","arduino-library","arduino-projects","esp-library","esp32","led-blinking","millis","non-blocking","software-timers","timing"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaakka.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-15T12:58:04.000Z","updated_at":"2024-11-20T11:48:20.000Z","dependencies_parsed_at":"2024-11-18T16:57:11.878Z","dependency_job_id":"fd4fed3d-8ae4-40f6-a32f-32b8723fb6d5","html_url":"https://github.com/jaakka/DelayFunctionsArduino","commit_stats":null,"previous_names":["jaakka/delayfunctionsarduino"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaakka%2FDelayFunctionsArduino","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaakka%2FDelayFunctionsArduino/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaakka%2FDelayFunctionsArduino/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaakka%2FDelayFunctionsArduino/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaakka","download_url":"https://codeload.github.com/jaakka/DelayFunctionsArduino/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243441930,"owners_count":20291558,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","arduino-library","arduino-projects","esp-library","esp32","led-blinking","millis","non-blocking","software-timers","timing"],"created_at":"2024-11-19T10:08:08.662Z","updated_at":"2025-12-28T00:20:10.151Z","avatar_url":"https://github.com/jaakka.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DelayFunctions Library for Arduino and ESP\n\nThe **DelayFunctions** library is a versatile tool for managing multiple software timers in Arduino and ESP projects. It provides a clean, non-blocking, and efficient way to handle timed events, making it ideal for tasks like LED blinking, button debouncing, or periodic updates.\n\nThe library is designed to handle the overflow of `millis()`. However, this has not been tested, but in practice, it should work.\n\nPlease give my project a star if you like it or find it useful.\n\n---\n\n## Key Features\n\n- **Dynamic Timer Allocation**  \n  Handle a user-defined number of timers with memory dynamically allocated for efficient resource usage.\n\n- **Flexible Timer Updates**  \n  Update timer intervals at runtime without restarting or losing track of the timer.\n\n- **Non-blocking Design**  \n  Uses the `millis()` function for asynchronous timing, ensuring smooth program execution without delays.\n\n- **Simple Interface**  \n  Easy-to-use functions for adding, updating, and managing timers within your main program loop.\n\nThis library helps streamline complex timing operations and keeps your code organized and efficient.\n\n---\n\n## Installation\n\nAvailable now from the official Arduino Library Manager.\n\n![image](https://github.com/user-attachments/assets/fb6774c0-e1aa-4530-9a12-9cde5967aadf)\n\n\nOR\n\n1. Download or clone the repository.\n2. Place the library in your Arduino `libraries` folder.\n3. Restart the Arduino IDE to access the library.\n\n---\n\n## API Reference\n\n### 1. `DelayFunctions(int maxTimers)`\n- **Description:** Creates a `DelayFunctions` object capable of managing up to `maxTimers`.\n- **Example:**  \n  ```cpp\n  DelayFunctions delayObj(3); // Maximum of 3 timers\n    ```\n\n### 2. `void NewDelayFunction(unsigned long interval, void (*callback)())`\n- **Description:** Adds a new timer with a specified `interval` (in milliseconds) and a `callback` function to execute when the timer elapses.\n- **Example:**\n  ```cpp\n  delayObj.NewDelayFunction(1000, myCallback); // Executes myCallback every 1000ms\n\n### 3. `void updateTime(void (*callback)(), unsigned long interval)`\n- **Description:** Updates the interval of an existing timer associated with the given `callback`.\n- **Example:**\n  ```cpp\n  delayObj.updateTime(myCallback, 500); // Changes interval to 500ms\n\n### 4. `void loop()`\n- **Description:** Call this method in the main `loop()` function to keep the timers running and execute callbacks when needed.\n- **Example:**\n  ```cpp\n  void loop() {\n    delayObj.loop();\n  }\n\n## Example Usage\n\nHere's a simple example to toggle an LED every second:\n\ncpp\n```\n#include \u003cDelayFunctions.h\u003e\n\n#define ledPin 2  // Use LED_BUILTIN for Arduino, pin 2 for ESP boards\n\n// Create a DelayFunctions object with capacity for 1 timer\nDelayFunctions delayObj(1);\n\n// Callback function for the timer\nvoid toggleLED() {\n  digitalWrite(ledPin, !digitalRead(ledPin)); // Toggle LED state\n}\n\nvoid setup() {\n  pinMode(ledPin, OUTPUT);\n  delayObj.NewDelayFunction(1000, toggleLED); // Create a timer to toggle LED every 1000ms\n}\n\nvoid loop() {\n  delayObj.loop(); // Keep timers running\n}\n```\n\n## How It Works\n\n1. **Setup Timers:** Create an instance of `DelayFunctions` and define your timers with specific intervals and callback functions.\n2. **Run the Loop:** Call the `loop()` method in your `loop()` function to process the timers and trigger callbacks as needed.\n3. **Extend Functionality:** Dynamically update intervals or add new timers during runtime.\n\n\n## Applications\n\n- Button debouncing\n- LED control (blinking, patterns)\n- Periodic sensor readings\n- Timed animations\n- General event scheduling in Arduino/ESP projects\n\n## Contributing\n\nContributions, suggestions, and bug reports are welcome! Please create an issue or submit a pull request.\n\n\n## License\n\nThis library is open-source and licensed under the MIT License. See the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaakka%2Fdelayfunctionsarduino","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaakka%2Fdelayfunctionsarduino","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaakka%2Fdelayfunctionsarduino/lists"}