I'm trying to light up an LED and play a buzzer noise at the same time. Here is my code so far:
Import RPi.GPIO as GPIO
Import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(7, GPIO.OUT)
while True:
GPIO.output(7, 1)
time.sleep(2)
GPIO.output(7,0)
time.sleep(2)
GPIO.cleanup()
and here is how my RBp is connected:
https://i.stack.imgur.com/QA4uZ.jpg
The LED lights up as expected but all I'm getting from the piezo is a very short static noise as if it's getting electricity. But no sustaining noise.
I don't think theres anything wrong with the code as I've seen multiple examples online that are basically identical and work with no issues. The buzzer I'm using is from the arduino starter kit if thats any help.
If anyone can help me figure out why it's not working that would be very appreciated!
sudo pigpiod
thenpigs p 7 128
Any noise? – joan Oct 13 '19 at 20:38