-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_collect_motors.py
78 lines (69 loc) · 2.25 KB
/
data_collect_motors.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import RPi.GPIO as GPIO
import time
from datetime import datetime
import os
import Adafruit_DHT
from adafruit_servokit import ServoKit
from pin_control import *
from sequences import *
# PWM 0 - 6 : doors
# PWM 8 - 15 : windows
# 00 : Bedroom 2 - Bathroom
# 01 : Bedroom 1 - Living Rm
# 02 : Living Rm - Kitchen
# 03 : Living Rm - Bathroom
# 04 : Bedroom 1 - Bathroom
# 05 : Living Rm - Front Door
# 06 : Bedroom 1 - Back Door
#----------------------------
# 08 : Bedroom 1, 2 ft.
# 09 : Living Rm, 2 ft.
# 10 : Bedroom 2, 2 ft
# 11 : Kitchen, 2 ft.
# 12 : Bedroom 2, 3 ft.
# 13 : Living Rm, 3 ft.
# 14 : Kitchen, 3 ft.
# 15 : Bedroom 1, 3 ft.
def debug_loop():
try:
while True:
print('Enter desired operation')
op = input().lower()
words = op.split()
if op == 'open all':
print("opening all doors and windows")
openAll()
elif op == 'close all':
print("closing all doors and windows")
closeAll()
elif op == 'open all doors':
print("opening all doors")
openAllDoors()
elif op == 'close all doors':
print("closing all doors")
closeAllDoors()
elif op == 'open all windows':
print("opening all windows")
openAllWindows()
elif op == 'close all windows':
print("closing all windows")
closeAllWindows()
elif words[0] == 'open':
#open based on pin number
print("opening " + motor_names[int(words[1])])
motorOpen(int(words[1]))
elif words[0] == 'close':
#close based on pin number
print("closing " + motor_names[int(words[1])])
motorClose(int(words[1]))
else:
print('Incorrect input.')
except KeyboardInterrupt:
print("Keyboard interrupt.")
except Exception as e:
print(e)
if __name__ == '__main__':
closeAll()
# perform desired scenario for data collection -- basically just the runner file with the debug loop method if necessary
#SEQUENCE_aNormalDay()
demo()