|
|
|
@ -3,14 +3,14 @@ import RPi.GPIO as GPIO
|
|
|
|
|
import keyboard
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
pin_config = {}
|
|
|
|
|
pin_config = []
|
|
|
|
|
with open('pin_config.json') as pin_config_stream:
|
|
|
|
|
pin_config = json.load(pin_config_stream)
|
|
|
|
|
if pin_config['mode'] == 'BOARD':
|
|
|
|
|
GPIO.setmode(GPIO.BOARD)
|
|
|
|
|
else:
|
|
|
|
|
GPIO.setmode(GPIO.BCM)
|
|
|
|
|
GPIO.setup(pin_config['frigde_btn'], GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
|
|
|
|
GPIO.setup(pin_config['fridge_btn'], GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
|
|
|
|
GPIO.setup(pin_config['tools_btn'], GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
|
|
|
|
GPIO.setup(pin_config['fridge_red_LED'], GPIO.OUT)
|
|
|
|
|
GPIO.setup(pin_config['fridge_grn_LED'], GPIO.OUT)
|
|
|
|
@ -70,4 +70,4 @@ if __name__ == '__main__':
|
|
|
|
|
history.append(event)
|
|
|
|
|
with open('history.json', 'w') as outfile:
|
|
|
|
|
json.dump(history, outfile)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|