-
Notifications
You must be signed in to change notification settings - Fork 1
/
ArduinoDaemon.py
34 lines (20 loc) · 921 Bytes
/
ArduinoDaemon.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
#!/usr/bin/env python
#This module can read data directly from the Arduino!
#it uses the serial protocol
#import serial for serial communications
import serial, time
import GeyserProto as GP
def ControlArduino(TempDataInStream, DaemonRunFlag, PressureVoltage):
while True:
#get some data now!
temperature_celcius = float(GP.getTemperature())
#put this to the queue
TempDataInStream.put(temperature_celcius)
#get the pressure transducer data and put that on memory
PressureVoltage.value = float(GP.getPressure())
#This routine checks if the stop flag is raised, and puts it in
#variable "runflag" to stop the loop
if DaemonRunFlag.qsize() != 0:
if DaemonRunFlag.get(timeout=1) == True:
RunFlag = False
time.sleep(1)