From 3717b2423415ffa0f5f44f271331c38fbaef0d24 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 8 Jun 2022 10:30:34 -0300 Subject: [PATCH] =?UTF-8?q?esperar=20si=20ning=C3=BAn=20arduino=20responde?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit no afecta el buen funcionamiento, pero si los arduinos se desconectan, el lector hace un pico de uso de cpu. --- raspberry/arduinos.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/raspberry/arduinos.py b/raspberry/arduinos.py index 711b5b9..d234a50 100755 --- a/raspberry/arduinos.py +++ b/raspberry/arduinos.py @@ -21,10 +21,11 @@ ser.write(serial.to_bytes(com)) ser.flush() while True: if ser.in_waiting > 0: - line = ser.readline().decode('utf-8', errors='replace').rstrip() - #time.sleep(0.1) - print(line) - ser.flush() - break - + line = ser.readline().decode('utf-8', errors='replace').rstrip() + print(line) + ser.flush() + break + + time.sleep(1) + quit()