-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystemControl.py
More file actions
executable file
·114 lines (89 loc) · 2.94 KB
/
systemControl.py
File metadata and controls
executable file
·114 lines (89 loc) · 2.94 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# System Control
import RPi.GPIO as GPIO
import time
import servoControl
from servoControl import Servo
import lightControl
from lightControl import Light
class System:
def __init__(self):
self.servoYaw = Servo(205,409,0)
self.servoPitch = Servo(205,409,1)
self.lampSpot = Servo(205,409,2)
self.lampLight = Servo(0,4095,4)
self.lightGreen = Light(18)
self.lightRed = Light(22)
self.laserPointer = Light(24)
def cleanUp(self):
GPIO.cleanup()
def turnOnRed(self):
self.lightRed.lightOn()
def turnOffRed(self):
self.lightRed.lightOff()
def turnOnGreen(self):
self.lightGreen.lightOn()
def turnOffGreen(self):
self.lightGreen.lightOff()
def turnOnLaser(self):
self.laserPointer.lightOn()
def turnOffLaser(self):
self.laserPointer.lightOff()
def blinkGreen(self):
self.lightGreen.lightOn()
time.sleep(0.005)
self.lightGreen.lightOff()
time.sleep(0.005)
self.lightGreen.lightOn()
time.sleep(0.005)
self.lightGreen.lightOff()
time.sleep(0.005)
self.lightGreen.lightOn()
time.sleep(0.005)
self.lightGreen.lightOff()
def blinkRed(self):
self.lightRed.lightOn()
time.sleep(0.005)
self.lightRed.lightOff()
time.sleep(0.005)
self.lightRed.lightOn()
time.sleep(0.005)
self.lightRed.lightOff()
time.sleep(0.005)
self.lightRed.lightOn()
time.sleep(0.005)
self.lightRed.lightOff()
def decLampBright(self):
self.lampLight.decrease()
def incLampBright(self):
self.lampLight.increase()
def decLampSpot(self):
self.lampSpot.decrease()
def incLampSpot(self):
self.lampSpot.increase()
def decLampPitch(self):
self.servoPitch.decrease()
def incLampPitch(self):
self.servoPitch.increase()
def decLampYaw(self):
self.servoYaw.decrease()
def incLampYaw(self):
self.servoYaw.increase()
def servoSetAllNeutral(self):
self.servoYaw.neutralPos()
self.servoPitch.neutralPos()
self.lampSpot.neutralPos()
self.lampLight.neutralPos()
def servoTestYaw(self):
for i in range(self.servoYaw.min, self.servoYaw.max, 1):
self.servoYaw.increase()
time.sleep(0.005)
for i in range(self.servoYaw.max-1, self.servoYaw.min-1, -1):
self.servoYaw.decrease()
time.sleep(0.005)
def servoTestPitch(self):
for i in range(self.servoPitch.min, self.servoPitch.max, 1):
self.servoPitch.increase()
time.sleep(0.005)
for i in range(self.servoPitch.max-1, self.servoPitch.min-1, -1):
self.servoPitch.decrease()
time.sleep(0.005)