Code: Select all
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.wait_for_edge("P8_8", GPIO.BOTH)
if GPIO.add_event_detect("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)
Seth
P.S. I change it a couple of times and I receive no errors but nothing seems to work. I keep waving but nothing has notified me via LED that the motion is being detected or not detected. Any suggestions?