Now accepting card input through the keyboard library

master
Davide Bongiovanni 8 years ago
parent 345513da99
commit 47c2adcab4

@ -1,5 +1,6 @@
import time, json import time, json
import RPi.GPIO as GPIO import RPi.GPIO as GPIO
import keyboard
if __name__ == '__main__': if __name__ == '__main__':
pin_config = {} pin_config = {}
@ -16,7 +17,9 @@ if __name__ == '__main__':
GPIO.setup(pin_config['tools_red_LED'], GPIO.OUT) GPIO.setup(pin_config['tools_red_LED'], GPIO.OUT)
GPIO.setup(pin_config['tools_grn_LED'], GPIO.OUT) GPIO.setup(pin_config['tools_grn_LED'], GPIO.OUT)
while True: while True:
cardID = raw_input("Enter card ID: ") print "Enter card ID:"
cardID_input = keyboard.record(until='enter')
cardID = keyboard.get_typed_strings(cardID_input)[0]
event = {} event = {}
event["time"] = time.time() event["time"] = time.time()
event["cardID"] = cardID event["cardID"] = cardID

Loading…
Cancel
Save