forked from demianvelasco/spacewear
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
65 lines (52 loc) · 1.54 KB
/
main.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from Tkinter import *
from BreakfastSerial import Arduino, Buzzer, Sensor, setInterval, Led
import time
board = Arduino()
led = Led(board, 12)
buzzer = Led(board, 8)
def alert():
print"Return to base"
led.blink(100)
buzzer.blink(100)
def oxygenAlert():
led.off()
buzzer.off()
led.on()
#time.sleep(2)
print"Current Oxygen level: |||||||||| 86 %"
def dangerAlert():
led.blink(1000)
buzzer.blink(800)
print"Danger Approaching. Return to base"
def co2Alert():
led.blink(1000)
buzzer.blink(800)
print"Oxygen level too low |||| 23% "
def batteryStatus():
led.blink(200)
print"Battery Status: |||||||||||| 65%"
def stopAlert():
led.off()
buzzer.off()
print"No current alerts"
if __name__ == "__main__":
master = Tk()
master.title("SpaceWear - KSC")
f = Frame(master, height=200, width=500)
f.pack_propagate(0) # don't shrink
f.pack()
alertButton = Button(master, text="Alert", command=dangerAlert)
alertButton.pack()
alertButton.place(bordermode=OUTSIDE, height=100, width=200)
oxygenButton = Button(master, text="Oxygen Levels", command=oxygenAlert)
oxygenButton.pack()
#oxygenButton.place(bordermode=OUTSIDE, height=200, width=200)
stopAlertButton = Button(master, text="Stop Alert", command=stopAlert)
stopAlertButton.pack()
alertButton2 = Button(master, text="Return to base", command=alert)
alertButton2.pack()
alertButton3 = Button(master, text="Battery Status", command=batteryStatus)
alertButton3.pack()
alertButton4 = Button(master, text="CO2 Status", command=co2Alert)
alertButton4.pack()
master.mainloop()