Skip to content

Instantly share code, notes, and snippets.

@mvidalgarcia
Last active September 10, 2015 20:19
Show Gist options
  • Save mvidalgarcia/6a85d5c3c55513791622 to your computer and use it in GitHub Desktop.
Save mvidalgarcia/6a85d5c3c55513791622 to your computer and use it in GitHub Desktop.
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
buzzer_pin = 24
GPIO.setup(buzzer_pin, GPIO.OUT)
def buzz():
GPIO.output(buzzer_pin, True)
time.sleep(0.0001)
GPIO.output(buzzer_pin, False)
try:
while(True):
buzz()
finally:
print("Cleaning up")
GPIO.cleanup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment