Go Down

Topic: Turning a Piezo buzzer off (Read 4076 times) previous topic - next topic

abasel

Why does
Code: [Select]
analogWrite(buzzer,255);

turn it off and

Code: [Select]
analogWrite(buzzer,0);

turn it on.

I thought that it would be the other way around.

JimboZA

Post the circuit.... if you have the buzzer +ve to 5V, and the -ve in an i/o pin, then you need the i/o pin to be at 0V for there to be a PD across the buzzer, so off is on.
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

abasel

Hi, it's an active buzzer http://www.aliexpress.com/snapshot/6164212500.html with I/O pin connected to A3. The VCC & GND are connected to 3.5V and GND respectively

Jiggy-Ninja

Look at the circuit diagram posted on that page. It uses a PNP transistor as a high-side switch. 5V will turn it off, 0V will turn it on. That's normal behavior for a high-side PNP.
Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0

JimboZA


Look at the circuit diagram posted on that page. It uses a PNP transistor as a high-side switch. 5V will turn it off, 0V will turn it on. That's normal behavior for a high-side PNP.


Damn- you beat me to it....
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

abasel

Thanks, I am learning slowly :-)

Go Up