This library allows you to customize your own Mountain DisplayPad by assigning each button its own custom function, image or color.
importasynciofromdisplaypadimportDisplayPadasyncdefmain():
# Create a new DisplayPad instancepad=DisplayPad.DisplayPad()
# Define event handlers@pad.on('down')defon_key_down(key_index):
print(f"Key {key_index} has been pressed.")
# Define event handlers@pad.on('up')defon_key_down(key_index):
print(f"Key {key_index} has been released.")
# Define event handlers@pad.on('error')defon_error(error):
print(f"Error: {error}")
# Clear all keyspad.clear_all_keys()
# Set the first three keys to red, green and bluepad.set_key_color(0, 255, 0, 0)
pad.set_key_color(1, 0, 255, 0)
pad.set_key_color(2, 0, 0, 255)
# Keep the script runningwhileTrue:
awaitasyncio.sleep(1)
if__name__=="__main__":
# Run the main functionasyncio.run(main())