Open
Description
(This is not an bug but an improvement request).
Tone works fine with passive buzzers that beep when the pin is HIGH : https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino/Tone.cpp#L494
I have a passive buzzers that has inverted logic. It is driven with a PNP transistor. I control the buzzer with a digital pin. The buzzer beeps when the pin is LOW.
The work around to keep using tone() with such buzzers is to call digitalWrite(buzzerPin, HIGH)
instead of noTone()
.
The downside is that "click" after the tone has played : https://www.youtube.com/watch?v=zVIw2HHbOZw
Is there a way to inverse this whole logic in Tone.cpp ?