Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- from gpiozero import MotionSensor
- from orvibo.s20 import S20 #https://github.com/happyleavesaoc/python-orvibo
- if __name__ == "__main__":
- s20 = S20("192.168.0.113")
- onaftermotion = 150
- pir = MotionSensor(14)
- while True:
- time.sleep(0.5)
- if pir.motion_detected:
- print("Motion detected!")
- try:
- s20.on = True
- print(time.ctime())
- pir.wait_for_no_motion()
- print("No Motion detected!")
- print(time.ctime())
- time.sleep(onaftermotion)
- s20.on = False
- except:
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement