-
Notifications
You must be signed in to change notification settings - Fork 0
/
IoTest.py
55 lines (38 loc) · 1.05 KB
/
IoTest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from CamDeviceConfig import deviceconfig
from Actuators import LedIndicator
from Inputs import IoInputs
import RPi.GPIO as GPIO
import time
#Start...
#TODO: make use of configfile
GPIO.setmode(GPIO.BCM)
redButton = IoInputs.PushButton(GPIO, 15)
greenButton = IoInputs.PushButton(GPIO, 14)
switch = IoInputs.OnOnSwitch(GPIO, 21, 12)
redButton.initialize()
greenButton.initialize()
switch.initialize()
redLed = LedIndicator.LedIndicator(GPIO, 24)
greenLed = LedIndicator.LedIndicator(GPIO, 23)
yellowLed = LedIndicator.LedIndicator(GPIO, 22)
print "Start testing...."
print "RedLed... On"
redLed.activate(True)
time.sleep(1)
print "GreenLed... On"
greenLed.activate(True)
time.sleep(1)
print "YellowLed... On"
yellowLed.activate(True)
time.sleep(1)
running = True
while(running):
try:
print "RedButtonState: " + str(redButton.update())
print "GreenButtonState: " + str(greenButton.update())
print "SwitchState" + str(switch.update())
time.sleep(0.2)
except:
running= False
GPIO.cleanup()
print "Test is done..."