Ejemplo n.º 1
0
def output(data, red=False, blue=False, green=False):
	tubeFunctions.off()
	GPIO.output(25, True)

	#set colours
	if blue:
		GPIO.output(10, True)
	if green:
		GPIO.output(24, True)

	#set data
	if (data & 1) == 1:
		GPIO.output(4, True)
	if (data & 2) == 2:
		GPIO.output(17, True)
	if (data & 4) == 4:
		GPIO.output(18, True)
	if (data & 8) == 8:
		GPIO.output(21, True)
	if (data & 16) == 16:
		GPIO.output(22, True)
	if (data & 32) == 32:
		GPIO.output(23, True)
	
	#clock
	GPIO.output(11, False)
	GPIO.output(11, True)
Ejemplo n.º 2
0
def wakeMode():
	global endTime
	global duration
	#adjust end time
	endTime = datetime.datetime.now() + datetime.timedelta(minutes=duration)
	
	#print "wakemode entered. Now:",datetime.datetime.now()," Endtime:",endTime
	while datetime.datetime.now() < endTime:
		tubeFunctions.ledStatus(True)
		loopDigits(1,1)
	
	tubeFunctions.ledStatus(False)
	tubeFunctions.off()
	#print "leaving wakemode. Time is now",datetime.datetime.now()
	updateTime.updateTime()
Ejemplo n.º 3
0
def toutput(tube, cathode, data):
	tubeFunctions.off()
	GPIO.output(25, False)

	#set tube addres

	if (tube & 1) == 1:
		GPIO.output(24, True)
	if (tube & 2) == 2:
		GPIO.output(10, True)
	if (tube & 4) == 4:
		GPIO.output(9, True)

	#set cathode

	if (cathode & 1) == 1:
		GPIO.output(18, True)
	if (cathode & 2) == 2:
		GPIO.output(21, True)
	if (cathode & 4) == 4:
		GPIO.output(22, True)
	if (cathode & 8) == 8:
		GPIO.output(23, True)

	#set data
	if (data & 1) ==1:
		GPIO.output(4, True)
	if (data & 2) == 2:
		GPIO.output(17, True)

	
	#clock
	GPIO.output(11, False)
	#time.sleep(1)
	GPIO.output(11, True)
	#time.sleep(1)
	GPIO.output(11, False)
Ejemplo n.º 4
0
import RPi.GPIO as GPIO
import time
from datetime import datetime
import tubeFunctions

GPIO.setmode(GPIO.BCM)
GPIO.setup(25, GPIO.IN, pull_up_down=GPIO.PUD_UP)

tubeFunctions.off()

while True:
	if GPIO.input(25) == 0:
		now = str(datetime.now())
		print now
		tubeFunctions.ld(0.1,1)
		tubeFunctions.off()	
		f = open('motionLog','a')
		f.write(now + "\n")
		f.close
		time.sleep(30)
Ejemplo n.º 5
0
def loopDigits(wait, iterations):
	i= 0
	global endTime
	global duration
	while i < iterations:
		for n in range(10):
			#tubeFunctions.outputDigit(n)
			if GPIO.input(25) == 0:
				endTime = datetime.datetime.now() + datetime.timedelta(minutes=duration)
				#print "endTime is now",endTime
			#time.sleep(wait)
			nextSecond = datetime.datetime.now() + datetime.timedelta(seconds=1)
			while datetime.datetime.now() < nextSecond:
				currentTime = datetime.datetime.now()
				hour = currentTime.hour
				hourMsb = hour / 10
				hourLsb = hour % 10				
				tubeFunctions.outputDigit(hourMsb)
				time.sleep(0.25)
				tubeFunctions.off()
				time.sleep(0.1)
				tubeFunctions.outputDigit(hourLsb)
				time.sleep(0.25)
				tubeFunctions.off()
				time.sleep(0.25)
				min = currentTime.minute
				minMsb = min / 10
				minLsb = min % 10
				tubeFunctions.outputDigit(minMsb)
				time.sleep(0.25)
				tubeFunctions.off()
				time.sleep(0.1)
				tubeFunctions.outputDigit(minLsb)
				time.sleep(0.25)
				tubeFunctions.off()
				time.sleep(0.25)
				sec = currentTime.second
				secMsb = sec / 10
				secLsb = sec % 10
				tubeFunctions.outputDigit(secMsb)
				time.sleep(0.25)
				tubeFunctions.off()
				time.sleep(0.1)
				tubeFunctions.outputDigit(secLsb)
				time.sleep(0.25)
				tubeFunctions.off()
				time.sleep(1.5)
		i = i + 1