-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
35 lines (26 loc) · 926 Bytes
/
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
from ast import While
from subprocess import call
import threading # Ref: https://www.geeksforgeeks.org/multithreading-python-set-1/
import time
class groupingSensors:
# def run_potensio_sensor():
# call(["python", "potensio.py"])
def run_dht_sensor2():
call(["python", "sensor-dht11.py"])
def run_hcsr04_sensor3():
call(["python", "sensor-hcsr04.py"])
if __name__ == "__main__":
# Listing threads
# sensor1 = threading.Thread(target = groupingSensors.run_potensio_sensor, name = "sensor1")
sensor2 = threading.Thread(target = groupingSensors.run_dht_sensor2, name = "sensor2")
sensor3 = threading.Thread(target = groupingSensors.run_hcsr04_sensor3, name = "sensor3")
# Starting threads
# sensor1.start()
sensor2.start()
sensor3.start()
# Joining threads
# sensor1.join()
sensor2.join()
sensor3.join()
# Looping
time.sleep(3)