1
0
Fork 0

reference switch name in output

This commit is contained in:
Kevin Matz 2019-11-17 11:30:36 -05:00
parent 32549a4d66
commit 0c69f65805
1 changed files with 3 additions and 3 deletions

View File

@ -53,12 +53,12 @@ for b in config.get('button', 'names').split(','):
closed = c.get('close', None)
opened = c.get('open', None)
# set up button on pin
print('init button on GPIO', pin)
print('init', b, 'on GPIO', pin)
_buttons[b] = Button(pin)
# connect button callbacks to anonymous functions
print('connecting GPIO', pin, '"closed" to macro', closed)
print('connecting', b, '"closed" to macro', closed)
_buttons[b].when_pressed = lambda macro=closed: _activate(macro)
print('connecting GPIO', pin, '"opened" to macro', opened)
print('connecting', b, '"opened" to macro', opened)
_buttons[b].when_released = lambda macro=opened: _activate(macro)
except (KeyError, GPIODeviceError) as e: