Example #1
0
	def load(delay):
		wand.delay = delay

		gp.load() # Setup GPIO pins for use
		
		#Setup input
		GPIO.mode(GPIO.BOARD)
		GPIO.setup(5,GPIO.IN)
		GPIO.mode(GPIO.BOARD)
		
		wand.writeChar('pad') #switch all GPIO to Off
Example #2
0
 def _gpio_setup(_cls, pin):
     if GPIO.mode() is None:
         GPIO.setmode(GPIO.BCM)
     GPIO.setup(pin, GPIO.OUT)
Example #3
0
	def wait():
		#Wait for wand to be flicked
		GPIO.mode(GPIO.BOARD)
		while (GPIO.input(5) == True):
			time.sleep(0.0001) #High polling rate 
		GPIO.mode(GPIO.BCM)
import RPi.GPIO as io
import datetime
import time
# import SDL_DS3231 # system time is already on ds3231

# init variables & misc. pins
io.setup(io.BCM)

pirPin = 9
relayPin = 10

relayState = 0
pirTimer = 0
lowerBound = (.25 * 3.325)

io.mode(pirPin, io.IN)
io.mode(relayPin, io.OUT)

pirState = io.input
flipRelay = io.output
timeDel = datetime.timedelta
lumin = urllib2.urlopen("https://api.thingspeak.com/channels/50301/fields/5/last").read()

# control flow functions - 
#  When lower boundary is TRUE and PIR is TRUE, init relayPin
# for $time, probably based upon PIR retriggering...

""" 

  test_the_waters() will test the conditions to determin
if the relay should be set ON or OFF; ambient brightness, occupancy,