Added logging of button presses

master
Davide Bongiovanni 8 years ago
parent 9c7bf52e8f
commit 2e59b80ed1

1
.gitignore vendored

@ -5,3 +5,4 @@ admin.json
cards/ cards/
history.json history.json
*.pyc *.pyc
tags

@ -51,6 +51,7 @@ if __name__ == '__main__':
event["time"] = time.time() event["time"] = time.time()
event["cardID"] = cardID event["cardID"] = cardID
event["name"] = '' event["name"] = ''
event["action"] = ''
try: try:
with open('cards/' + cardID + '.json') as card_data: with open('cards/' + cardID + '.json') as card_data:
data = json.load(card_data) data = json.load(card_data)
@ -71,6 +72,7 @@ if __name__ == '__main__':
GPIO.output(pin_config['tools_grn_LED'], GPIO.LOW) GPIO.output(pin_config['tools_grn_LED'], GPIO.LOW)
GPIO.output(pin_config['fridge_red_LED'], GPIO.LOW) GPIO.output(pin_config['fridge_red_LED'], GPIO.LOW)
GPIO.output(pin_config['tools_red_LED'], GPIO.LOW) GPIO.output(pin_config['tools_red_LED'], GPIO.LOW)
event['action'] = 'tools'
wait = False wait = False
# Open tools # Open tools
subprocess.call("/home/pi/ELAB-RFID-I2C/RPi/i2c_challenge 0x30", shell=True) subprocess.call("/home/pi/ELAB-RFID-I2C/RPi/i2c_challenge 0x30", shell=True)
@ -79,6 +81,7 @@ if __name__ == '__main__':
GPIO.output(pin_config['tools_grn_LED'], GPIO.LOW) GPIO.output(pin_config['tools_grn_LED'], GPIO.LOW)
GPIO.output(pin_config['fridge_red_LED'], GPIO.LOW) GPIO.output(pin_config['fridge_red_LED'], GPIO.LOW)
GPIO.output(pin_config['tools_red_LED'], GPIO.LOW) GPIO.output(pin_config['tools_red_LED'], GPIO.LOW)
event['action'] = 'fridge'
wait = False wait = False
# Open fridge # Open fridge
subprocess.call("/home/pi/ELAB-RFID-I2C/RPi/i2c_challenge 0x20", shell=True) subprocess.call("/home/pi/ELAB-RFID-I2C/RPi/i2c_challenge 0x20", shell=True)

Loading…
Cancel
Save