diff options
author | Olivier Gayot <og@satcom1.com> | 2016-04-10 08:44:57 +0200 |
---|---|---|
committer | Olivier Gayot <og@satcom1.com> | 2016-04-10 08:44:57 +0200 |
commit | ae2b94d7690059849ee4678c58dac624ea9ccda3 (patch) | |
tree | 688622ed05f54aa1d84a01fffa90a8750be8310e /reader/reader.py | |
parent | 7aaa2f7ae9fbc2c2ec981c6cfb2e1b64605ff2de (diff) |
new version
Signed-off-by: Olivier Gayot <og@satcom1.com>
Diffstat (limited to 'reader/reader.py')
-rw-r--r-- | reader/reader.py | 7 |
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__': |