from LED_switch_matrix import LEDSwitchMatrix
from time import sleep
def switches_callback(matrix):
if matrix.switch_changed:
matrix.set_all_LEDs(matrix.switches_state)
# print("Current: {}\tAdded: {}\tRemoved: {}".format( \
# matrix.current, matrix.pressed, matrix.released))
for k in matrix.released:
print(f"Released: {k}")
for k in matrix.pressed:
print(f"Pressed: {k}")
lsm = LEDSwitchMatrix(freq=2000, out_base=0, in_base=8, sideset_base=18)
lsm.callback = switches_callback
while True:
lsm.setLED(31, True)
sleep(1)
lsm.setLED(31, False)
sleep(1)