Skip to content

Instantly share code, notes, and snippets.

@lvidarte
Last active June 27, 2016 11:28
Show Gist options
  • Save lvidarte/83019cf6283bbed9c257488cbbf54e75 to your computer and use it in GitHub Desktop.
Save lvidarte/83019cf6283bbed9c257488cbbf54e75 to your computer and use it in GitHub Desktop.
from gpiozero import MotionSensor, Buzzer
import time
pir = MotionSensor(22)
bz = Buzzer(17)
print("Waiting for PIR to settle")
pir.wait_for_no_motion()
while True:
print("Ready")
pir.wait_for_motion()
print("Motion detected!")
bz.beep(0.5, 0.25, 8)
time.sleep(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment