A helper library for the Adafruit MacroPad RP2040.
This driver depends on:
- Adafruit CircuitPython
- Adafruit's CircuitPython NeoPixel library
- Adafruit's CircuitPython HID library
- Adafruit's CircuitPython MIDI library
- Adafruit's CircuitPython Display Text library
- Adafruit's CircuitPython Simple Text Display library
- Adafruit's CircuitPython Debouncer library
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.
This library is designed to work withe the Adafruit MacroPad RP2040. Consider purchasing one from the Adafruit shop:
Adafruit MacroPad RP2040 Bare Bones Adafruit MacroPad RP2040 Starter Kit
Make sure that you have circup
installed in your Python environment.
Install it with the following command if necessary:
pip3 install circup
With circup
installed and your CircuitPython device connected use the
following command to install:
circup install adafruit_macropad
Or the following command to update an existing version:
circup update
This example prints out the key pressed, the relative position of the rotary encoder and the state of the rotary encoder switch.
from adafruit_macropad import MacroPad
import time
macropad = MacroPad()
while True:
key_event = macropad.keys.events.get()
if key_event and key_event.pressed:
print("Key pressed: {}".format(key_event.key_number))
print("Encoder: {}".format(macropad.encoder))
print("Encoder switch: {}".format(macropad.encoder_switch))
time.sleep(0.4)
API documentation for this library can be found on Read the Docs.
For information on building library documentation, please check out this guide.
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.