Pages: [1]   Go Down
Author Topic: Turning a Piezo buzzer off  (Read 438 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why does
Code:
analogWrite(buzzer,255);

turn it off and

Code:
analogWrite(buzzer,0);

turn it on.

I thought that it would be the other way around.
Logged

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 114
Posts: 4961
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

The Elders of the Internet know who I am
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
God Member
*****
Karma: 15
Posts: 508
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 114
Posts: 4961
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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....
Logged

The Elders of the Internet know who I am
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks, I am learning slowly :-)
Logged

Pages: [1]   Go Up
Jump to: