-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
31 lines (25 loc) · 728 Bytes
/
Copy pathmain.py
File metadata and controls
31 lines (25 loc) · 728 Bytes
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
import time
import RPi.GPIO as GPIO
from Set.set_gpio import MySet
from IoT_Space.sensor import IoTSpace
from AIoT_Space.sensor import AIoTSpace
class Controller:
def __init__(self):
MySet.setmode(self)
MySet.setup(self)
self.iot_space = IoTSpace()
self.aiot_space = AIoTSpace()
def run(self):
while True:
try:
self.iot_space.run()
self.aiot_space.run()
time.sleep(10)
except RuntimeError as e:
print("Reading from Sensor failure: ", e.args)
if __name__ == "__main__":
controller = Controller()
try:
controller.run()
except KeyboardInterrupt:
GPIO.cleanup()