Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

delay() is inaccurate, averaging 500us too short.

Open
#60 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Domain
embedded-iot

Research direction

Start at the SAM/SAMD implementation of delay(n) and compare its millisecond-counter behavior with the linked AVR issue and commit. Done means elapsed time in the current millisecond is accounted for so delay(n) no longer averages about 500us too short.

Written by the indexing model from the issue text.

Description

Since delay(n) waits for n ticks of the millisecond counter, any time already elapsed in the "current" millisecond isn't taken into account.

This was fixed a long time ago for the AVR, but it didn't make it into SAMD/SAM

https://github.com/arduino/Arduino/issues/237

https://github.com/arduino/ArduinoCore-avr/commit/67c0a1995aace2953e481ef6183b1b91e04942fc#diff-ab397febf179e1982f4ee0758df4c982

Dominant language
HTML
Stars
91
Forks
112
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from arduino/ArduinoCore-sam

All issues in arduino/ArduinoCore-sam

Similar issues

More Embedded & IoT issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.