Created
April 11, 2020 06:44
-
-
Save oschettler/785b2a65b9e201e247cfef9b4f834561 to your computer and use it in GitHub Desktop.
Motion detector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Detect motion | |
from gpiozero import Buzzer, MotionSensor | |
from time import sleep | |
buz = Buzzer(17) | |
pir = MotionSensor(4) | |
while True: | |
pir.wait_for_motion() | |
buz.on() | |
sleep(5) | |
buz.off() | |
pir.wait_for_no_motion() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment