summaryrefslogtreecommitdiff
path: root/reader/reader.py
diff options
context:
space:
mode:
Diffstat (limited to 'reader/reader.py')
-rw-r--r--reader/reader.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/reader/reader.py b/reader/reader.py
index 8e4fe2c..5868bcb 100644
--- a/reader/reader.py
+++ b/reader/reader.py
@@ -24,8 +24,8 @@ def main():
thread.start_new_thread(server_procedure, (server,))
- #with serial.Serial('/dev/ttyACM0', 9600) as ser:
- with open('/tmp/fifo') as ser:
+ with serial.Serial('/dev/ttyACM0', 9600) as ser:
+ #with open('/tmp/fifo') as ser:
while True:
line = ser.readline()
@@ -43,6 +43,7 @@ def main():
measures['flexion'] = line.split('FLEXION:')[1]
elif line.startswith('ANGLE_X:'):
measures['angle_x'] = line.split('ANGLE_X:')[1]
+ server.send_message_to_all(json.dumps(measures))
elif line.startswith('ANGLE_Y:'):
measures['angle_y'] = line.split('ANGLE_Y:')[1]
elif line.startswith('ANGLE_Z:'):
@@ -50,8 +51,6 @@ def main():
else:
print(line)
- server.send_message_to_all(json.dumps(measures))
-
if __name__ == '__main__':