arduino / arduino/ArduinoCore-avr
tone() used with delay()
- Dominant language
- C
- Stars
- 1.5k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
If the delay is less than the duration no tone will play. Using delay() after tone() only works if the delay is longer than the tone's duration, and then only for the time that is equal to (duration - delay)
For example, looping the following plays nothing:
tone(piezoPin, 2000, 500);
delay(500);
While looping the following plays 500ms tones followed by 50ms of silences
tone(piezoPin, 2000, 500);
delay(550);
Using official build 1.8.7
Contributor guide
No contributing guide indexed for this repository
Research direction
No source file or test is named in the issue. Start by reproducing the two tone()/delay() sketches on Arduino AVR using the reported 1.8.7 build, then trace the tone and delay implementation. Done means the documented timing cases produce the expected tones and silences, with a regression test if the existing test structure supports it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100