Forum > Linux PDAs

Buzzer to raspberry pi 2

(1/3) > >>

xinyiman:
Hello guys, I bought a buzzer for my raspberry pi 2.
Now comes the difficult, after connecting how do I let him make a sound?

Thanks for the help

xinyiman:
Any suggestions? No one has ever done this with Lazarus?

SymbolicFrank:
A buzzer is like a switch. It "clicks" every time you turn it on or off. To make it buzz, do that very fast.

First you have to find out how it is connected. If it is simply connected between +3.3V and a GPIO pin, use a library for that, a timer, and just swap the state:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure MyTimerOnTimer(Sender: TObject);begin  MyTimerPin := not MyTimerPin;end; 

xinyiman:
for my buzzer I have three cables

Yellow: in
Red: vcc
Black: gnd

The gpio is the raspberry pi 2. Tell me about what you want to pin gpio I put them so we reason with the same data.

Also refer to a library. To what are you referring to?

Thanks

SymbolicFrank:
GPIO Library.

If it has three wires, it has a built-in resonator, so you only have to turn it on once to get it buzzing, you don't need a timer.

Navigation

[0] Message Index

[#] Next page

Go to full version