{"id":20368230,"url":"https://github.com/martinvichnal/antidelay","last_synced_at":"2026-04-13T17:01:54.987Z","repository":{"id":214888321,"uuid":"737584940","full_name":"martinvichnal/AntiDelay","owner":"martinvichnal","description":"AntiDelay is a library that aims to provide non-blocking delay functionality in your Arduino project.","archived":false,"fork":false,"pushed_at":"2024-01-03T12:25:16.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-07T13:37:18.889Z","etag":null,"topics":["arduino","arduino-library","delay","esp32","esp32-arduino","esp8266","esp8266-arduino","non-blocking"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/martinvichnal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-12-31T16:17:21.000Z","updated_at":"2025-06-27T22:13:35.000Z","dependencies_parsed_at":"2025-01-15T05:07:32.275Z","dependency_job_id":"7d711353-f5df-47c7-a869-8e2b041b341d","html_url":"https://github.com/martinvichnal/AntiDelay","commit_stats":null,"previous_names":["martinvichnal/antidelay"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/martinvichnal/AntiDelay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinvichnal%2FAntiDelay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinvichnal%2FAntiDelay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinvichnal%2FAntiDelay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinvichnal%2FAntiDelay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martinvichnal","download_url":"https://codeload.github.com/martinvichnal/AntiDelay/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinvichnal%2FAntiDelay/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31761996,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T15:25:13.801Z","status":"ssl_error","status_checked_at":"2026-04-13T15:25:09.162Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","delay","esp32","esp32-arduino","esp8266","esp8266-arduino","non-blocking"],"created_at":"2024-11-15T00:39:51.299Z","updated_at":"2026-04-13T17:01:54.951Z","avatar_url":"https://github.com/martinvichnal.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AntiDelay\n\n![](https://img.shields.io/github/v/release/martinvichnal/AntiDelay)\n![](https://img.shields.io/github/last-commit/martinvichnal/AntiDelay)\n![](https://img.shields.io/github/issues/martinvichnal/AntiDelay)\n\n---\n\n## Overview\n\nThe `AntiDelay` library provides a non-blocking delay functionality for Arduino. It allows you to delay a function or a section of code without interrupting the microcontroller's code flow. This is particularly useful in applications where you need to perform multiple tasks concurrently.\n\n-   _Feel free to **improve, use or fork** this repository in your own projects :)_\n-   _For any bugs or improvements feel free to make an [issue](https://github.com/martinvichnal/AntiDelay/issues) or make a [pull request](https://github.com/martinvichnal/AntiDelay/pulls)_\n\n---\n\n# Table of Contents\n\n-   [AntiDelay](#antidelay)\n    -   [Overview](#overview)\n-   [Table of Contents](#table-of-contents)\n-   [Class Definition](#class-definition)\n-   [Methods](#methods)\n    -   [AntiDelay(unsigned long interval)](#antidelayunsigned-long-interval)\n    -   [operator bool()](#operator-bool)\n    -   [reset()](#reset)\n    -   [setInterval(unsigned long interval)](#setintervalunsigned-long-interval)\n    -   [pause()](#pause)\n    -   [resume()](#resume)\n    -   [isRunning()](#isrunning)\n-   [Use Cases](#use-cases)\n    -   [Blinking an LED without blocking](#blinking-an-led-without-blocking)\n    -   [Pausing and resuming a delay](#pausing-and-resuming-a-delay)\n    -   [Changing the delay interval](#changing-the-delay-interval)\n\n---\n\n# Class Definition\n\n```cpp\nclass AntiDelay\n{\n  public:\n    AntiDelay(unsigned long interval);\n    operator bool();\n    void reset();\n    void setInterval(unsigned long interval);\n    void pause();\n    void resume();\n    bool isRunning();\n\n  private:\n    unsigned long timeInterval;\n    unsigned long previousMillis;\n    bool isPaused;\n    unsigned long pauseOffset;\n};\n\n```\n\n# Methods\n\n## AntiDelay(unsigned long interval)\n\nThe constructor for the AntiDelay class. It takes one parameter: the delay interval in milliseconds.\n\n## operator bool()\n\nThis operator allows an AntiDelay object to be used in a conditional statement. It returns true if the delay interval has passed since the last time it returned true, and false otherwise.\n\n## reset()\n\nThis method resets the delay timer to the current time.\n\n## setInterval(unsigned long interval)\n\nThis method changes the delay interval. It takes one parameter: the new delay interval in milliseconds.\n\n## pause()\n\nThis method pauses the delay timer. While the timer is paused, the operator bool() method will always return false.\n\n## resume()\n\nThis method resumes the delay timer if it was previously paused. The timer will pick up where it left off.\n\n## isRunning()\n\nThis method returns true if the delay timer is currently running (i.e., the delay interval has not yet passed or the timer is not paused), and false otherwise.\n\n# Use Cases\n\n## Blinking an LED without blocking\n\nYou can use the AntiDelay library to blink an LED at a regular interval without blocking the rest of your code. This allows your Arduino to perform other tasks at the same time.\n\n```cpp\n#include \"AntiDelay.h\"\n\nAntiDelay blinkDelay(1000); // 1 second delay\n\nvoid loop() {\n  if (blinkDelay) {\n    digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); // Toggle the LED\n  }\n  // Other code here will run concurrently with the LED blinking\n}\n\n```\n\n## Pausing and resuming a delay\n\nYou can pause and resume a delay using the pause() and resume() methods. This is useful in situations where you need to temporarily stop a recurring action.\n\n```cpp\n#include \"AntiDelay.h\"\n\nAntiDelay actionDelay(1000); // 1 second delay\n\nvoid loop() {\n  if (actionDelay) {\n    // Perform some action\n  }\n  if (someCondition) {\n    actionDelay.pause();\n  }\n  if (someOtherCondition) {\n    actionDelay.resume();\n  }\n}\n\n```\n\n## Changing the delay interval\n\nYou can change the delay interval on the fly using the setInterval() method. This is useful in situations where the delay needs to be adjusted based on some condition.\n\n```cpp\n#include \"AntiDelay.h\"\n\nAntiDelay variableDelay(1000); // 1 second delay\n\nvoid loop() {\n  if (variableDelay) {\n    // Perform some action\n  }\n  if (someCondition) {\n    variableDelay.setInterval(2000); // Change the delay to 2 seconds\n  }\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinvichnal%2Fantidelay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinvichnal%2Fantidelay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinvichnal%2Fantidelay/lists"}