{"id":16219357,"url":"https://github.com/ivanseidel/duetimer","last_synced_at":"2025-10-12T15:14:20.729Z","repository":{"id":7754269,"uuid":"9121865","full_name":"ivanseidel/DueTimer","owner":"ivanseidel","description":"⏳ Timer Library fully implemented for Arduino DUE","archived":false,"fork":false,"pushed_at":"2023-02-03T09:18:49.000Z","size":77,"stargazers_count":216,"open_issues_count":21,"forks_count":89,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-05-19T13:07:12.404Z","etag":null,"topics":["arduino","arduino-library","timer"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivanseidel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-30T21:05:00.000Z","updated_at":"2025-05-01T12:09:11.000Z","dependencies_parsed_at":"2023-02-18T05:16:00.470Z","dependency_job_id":null,"html_url":"https://github.com/ivanseidel/DueTimer","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/ivanseidel/DueTimer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanseidel%2FDueTimer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanseidel%2FDueTimer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanseidel%2FDueTimer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanseidel%2FDueTimer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivanseidel","download_url":"https://codeload.github.com/ivanseidel/DueTimer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanseidel%2FDueTimer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279011848,"owners_count":26085004,"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","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","timer"],"created_at":"2024-10-10T11:54:25.067Z","updated_at":"2025-10-12T15:14:20.711Z","avatar_url":"https://github.com/ivanseidel.png","language":"C++","readme":"# DueTimer\n\nTimer Library to work with Arduino DUE\n\n## Installation\n\n1. [Download](https://github.com/ivanseidel/DueTimer/releases) the Latest release from GitHub.\n2. Unzip and modify the Folder name to \"DueTimer\" (Remove the '-version')\n3. Paste the modified folder on your Library folder (On your `Libraries` folder inside Sketchbooks or Arduino software).\n4. Re-open Arduino Software\n\n## Getting Started\n\nTo call a function `handler` every `1000` microseconds:\n\n```c++\nTimer3.attachInterrupt(handler).start(1000);\n// or:\nTimer3.attachInterrupt(handler).setPeriod(1000).start();\n// or, to select whichever available timer:\nTimer.getAvailable().attachInterrupt(handler).start(1000);\n```\n\nTo call a function `handler` `10` times a second:\n\n```c++\nTimer3.attachInterrupt(handler).setFrequency(10).start();\n```\n\nIn case you need to stop a timer, just do like this:\n\n```c++\nTimer3.stop();\n```\n\nAnd to continue running:\n\n```c++\nTimer3.start();\n```\n\nThere are `9` Timer objects already instantiated for you:\n`Timer0`, `Timer1`, `Timer2`, `Timer3`, `Timer4`, `Timer5`, `Timer6`, `Timer7` and `Timer8`.\n\n### TIPs and Warnings\n\n```c++\nTimer4.attachInterrupt(handler).setFrequency(10).start();\n// Is the same as:\nTimer4.attachInterrupt(handler);\nTimer4.setFrequency(10);\nTimer4.start();\n\n// To create a custom timer, refer to:\nDueTimer myTimer = DueTimer(0); // Creates a Timer 0 object.\nDueTimer myTimer = DueTimer(3); // Creates a Timer 3 object.\nDueTimer myTimer = DueTimer(t); // Creates a Timer t object.\n// Note: Maximum t allowed is 8, as there is only 9 timers [0..8];\n\nTimer1.attachInterrupt(handler1).start(10);\nTimer1.attachInterrupt(handler2).start(10);\nDueTimer myTimer = DueTimer(1);\nmyTimer.attachInterrupt(handler3).start(20);\n// Will run only handle3, on Timer 1 (You are just overriding the callback)\n\nTimer.getAvailable().attachInterrupt(callback1).start(10);\n// Start timer on first available timer\nDueTimer::getAvailable().attachInterrupt(callback2).start(10);\n// Start timer on second available timer\n// And so on...\n\nDueTimer myTimer = Timer.getAvailable();\nif (myTimer != DueTimer(0))\n// Now we know that the timer returned is actually available\n// Can compare timers using == or !=\n\n```\n\n### Compatibility with Servo.h\n\nBecause Servo Library uses the same callbacks of DueTimer, we provides a custom solution for working with both of them. However, Timers 0,2,3,4 and 5 will not Work anymore.\n\nYou will need uncommend the line in `DueTimer.h` in `DueTimer` folder inside the `Libraries` folder. Uncomment the following line in `DueTimer.h`:\n\n```\n#define USING_SERVO_LIB\ttrue\n```\n\n## Library Reference\n\n### You should know:\n\n- `getAvailable()` - Get the first available Timer.\n\n- `attachInterrupt(void (*isr)())` - Attach a interrupt (callback function) for the timer of the object.\n\n- `detachInterrupt()` - Detach current callback of timer.\n\n- `start(long microseconds = -1)` - Start the timer with an optional period parameter.\n\n- `stop()` - Stop the timer\n\n- `setFrequency(long frequency)` - Set the timer frequency\n\n- `long getFrequency()` - Get the timer frequency\n\n- `setPeriod(long microseconds)` - Set the timer period (in microseconds)\n\n- `long getPeriod()` - Get the timer period (in microseconds)\n\n### You don't need to know:\n\n\u003c\u003c\u003c\u003c\u003c\u003c\u003c HEAD\n- `int timer` - Stores the object timer id (to access Timers struct array).\n\n- `DueTimer(unsigned short _timer)` - Instantiate a new DueTimer object for Timer _timer (NOTE: All objects are already instantiated!).\n\n- `static const Timer Timers[]` - Stores all timers information\n\n- `static void (*callbacks[])()` - Stores all callbacks for all timers\n\n\n### Hardware Information\n\nMore information on the Timer Counter module of the µC on the Arduino Due\ncan be found in the documentation file [TimerCounter](TimerCounter.md).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanseidel%2Fduetimer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivanseidel%2Fduetimer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanseidel%2Fduetimer/lists"}