diff options
author | xengineering <mail2xengineering@protonmail.com> | 2020-10-30 11:23:09 +0100 |
---|---|---|
committer | xengineering <mail2xengineering@protonmail.com> | 2020-10-30 11:23:09 +0100 |
commit | cc2479fe1f83623f0a4a9c928b0c05ae102f5e16 (patch) | |
tree | 960bdf554e6f883847bc15930e5724f0524aaf45 /iot_barcode_transmitter | |
parent | bef7293b8e6a8337026d695d3467cc667390019b (diff) | |
download | iot-barcode-scanner-main.tar iot-barcode-scanner-main.tar.zst iot-barcode-scanner-main.zip |
Diffstat (limited to 'iot_barcode_transmitter')
-rwxr-xr-x | iot_barcode_transmitter | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/iot_barcode_transmitter b/iot_barcode_transmitter index 5b08111..37336ef 100755 --- a/iot_barcode_transmitter +++ b/iot_barcode_transmitter @@ -25,8 +25,12 @@ def main(): while True: with open(fifo_path, "r") as fifo: - keycode = fifo.read() - character = KEYMAP[keycode] + keycode = fifo.readline() + if keycode in KEYMAP: + character = KEYMAP[keycode] + else: + print("Keycode not recognized") + character = "" if character is "\n": mqtt_service.client.publish( topic, |