Skip to content

Tone (inverted logic) #489

Open
Open
@musapinar

Description

@musapinar

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions