From ff381ba87cc96c9f71e63734105c1c365bd7629b Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 20 Jan 2016 13:10:10 -0500 Subject: [PATCH] pySerial no longer has a flushInput() function It is now called reset_input_buffer() Signed-off-by: Anna Schumaker --- doors.py | 2 +- simulator/serial.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doors.py b/doors.py index eea3d3a..8d337ef 100755 --- a/doors.py +++ b/doors.py @@ -152,8 +152,8 @@ import serial RFID_SERIAL = serial.Serial(RFID_PATH, 2400, timeout=1) def read_key(): + RFID_SERIAL.reset_input_buffer() # Clear input buffer before reading string = RFID_SERIAL.read(12) - RFID_SERIAL.flushInput() # ignore errors, no data if len(string) > 0: key = string[1:11].decode() #exclude start x0A and stop x0D bytes if key.isalnum(): diff --git a/simulator/serial.py b/simulator/serial.py index eea9494..5ad2b6c 100644 --- a/simulator/serial.py +++ b/simulator/serial.py @@ -36,5 +36,5 @@ class Serial: return "".encode() raise Exception("Test Serial Exception") - def flushInput(self): + def reset_input_buffer(): pass