RE: Ideas and PIR Sensor to LED Notification

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

RE: Ideas and PIR Sensor to LED Notification

Post by silver2row »

Hello,

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)
This is some software put together to try to give alarm via LED from a PIR sensor in Python3 on the BBB.

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?

User avatar
silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: RE: Ideas and PIR Sensor to LED Notification

Post by silver2row »

Hello,

I did receive an error once. I cannot remember my source at the time but if it helps, here is the error:

Code: Select all

RuntimeError: (17, 'File exists')
Seth

User avatar
silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: RE: Ideas and PIR Sensor to LED Notification

Post by silver2row »

Hello Again,

Do not worry about it. I think I figured out that these devices, the PIR Sensors, need about a one-minute interval to function properly. I will have to let the source run longer on my console.

Seth

P.S. Thank you for reading this bunch of confusion anyway. Testing will ensue!

Locked
Please be positive and constructive with your questions and comments.

Return to “Beagle Bone & Adafruit Beagle Bone products”