Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tone (inverted logic) #489

Open
musapinar opened this issue Jul 11, 2022 · 0 comments
Open

Tone (inverted logic) #489

musapinar opened this issue Jul 11, 2022 · 0 comments

Comments

@musapinar
Copy link

(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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants