From ae2b94d7690059849ee4678c58dac624ea9ccda3 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Sun, 10 Apr 2016 08:44:57 +0200 Subject: new version Signed-off-by: Olivier Gayot --- reader/reader.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'reader/reader.py') 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__': -- cgit v1.2.3