We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4d12c30 commit 46f6cadCopy full SHA for 46f6cad
cores/arduino/Tone.cpp
@@ -57,6 +57,14 @@ void toneAccurateClock (uint32_t accurateSystemCoreClockFrequency)
57
58
void tone (uint32_t outputPin, uint32_t frequency, uint32_t duration)
59
{
60
+
61
+ // Avoid divide by zero error by calling 'noTone' instead
62
+ if (frequency == 0)
63
+ {
64
+ noTone(outputPin);
65
+ return;
66
+ }
67
68
// Configure interrupt request
69
NVIC_DisableIRQ(TONE_TC_IRQn);
70
NVIC_ClearPendingIRQ(TONE_TC_IRQn);
0 commit comments