Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Adafruit_BBIO.GPIO as GPIO
- import time
- #import tweepy
- #import os
- #import sys
- GPIO.setup("P8_8", GPIO.IN)
- GPIO.setup("P8_12", GPIO.OUT)
- while True:
- GPIO.add_event_detect("P8_8", GPIO.FALLING)
- if GPIO.event_detected("P8_8"):
- GPIO.output("P8_12", GPIO.HIGH)
- print("Motion Has Been Detected!")
- time.sleep(2)
- else:
- GPIO.output("P8_12", GPIO.LOW)
- print("No Intruders Yet!")
- time.sleep(2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement