The wiring seemed pretty trivial as did the required code.
I have the following buzzer module: http://www.ebay.com/itm/KY-006-Passive-Buzzer-Module-Arduino-AVR-PIC-/370886693686?pt=LH_DefaultDomain_0&hash=item565a91d336
I'm trying to produce any sound at all but so far it's not going all that great. Here is my wire setup:
RPi | Buzzer
----------------------------------
GND (Pin 06) | GND (-) (First Pin)
5V (Pin 04) | VCC (Middle Pin)
BCM18 (Pin 18) | S (Last Pin - Marked S)
And my code:
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
try:
while True:
GPIO.output(18, True)
time.sleep(1/5)
GPIO.output(18, False)
except KeyboardInterrupt:
GPIO.cleanup()
However I don't get even a beep out of it. I have 7 of these modules that I got from my class mate they used them in class. What am I missing here. I also tried using GPIO.BOARD
and GPIO Pin
14 but still nothing no sound/beep.