Go Down

Topic: Turning a Piezo buzzer off (Read 826 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.
meArm build blog:     http://jimbozamearm.blogspot.com/

Please don't PM for technical advice. Firstly my advice is sometimes wrong, and second, in the forum you get a broader, more timely, range of responses.

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.

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....
meArm build blog:     http://jimbozamearm.blogspot.com/

Please don't PM for technical advice. Firstly my advice is sometimes wrong, and second, in the forum you get a broader, more timely, range of responses.

abasel

Thanks, I am learning slowly :-)

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy