Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sytxlabs/displaypad
This library allows you to customize your own Mountain DisplayPad by assigning each button its own custom function, image or color.
https://github.com/sytxlabs/displaypad
displaypad mountain mountain-displaypad
Last synced: about 1 month ago
JSON representation
This library allows you to customize your own Mountain DisplayPad by assigning each button its own custom function, image or color.
- Host: GitHub
- URL: https://github.com/sytxlabs/displaypad
- Owner: SytxLabs
- License: mit
- Created: 2024-10-16T17:16:42.000Z (2 months ago)
- Default Branch: master
- Last Pushed: 2024-10-19T02:34:30.000Z (2 months ago)
- Last Synced: 2024-10-20T03:38:15.576Z (2 months ago)
- Topics: displaypad, mountain, mountain-displaypad
- Language: Python
- Homepage: https://github.com/SytxLabs/DisplayPad
- Size: 38.1 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DisplayPad
This library allows you to customize your own Mountain DisplayPad by assigning each button its own custom function, image or color.# Example
```python
import asynciofrom displaypad import DisplayPad
async def main():
# Create a new DisplayPad instance
pad = DisplayPad.DisplayPad()# Define event handlers
@pad.on('down')
def on_key_down(key_index):
print(f"Key {key_index} has been pressed.")# Define event handlers
@pad.on('up')
def on_key_down(key_index):
print(f"Key {key_index} has been released.")# Define event handlers
@pad.on('error')
def on_error(error):
print(f"Error: {error}")# Clear all keys
pad.clear_all_keys()# Set the first three keys to red, green and blue
pad.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 running
while True:
await asyncio.sleep(1)if __name__ == "__main__":
# Run the main function
asyncio.run(main())
```