Here's the MIDI controller button box firmware for a Raspberry Pi Pico flashed with CircuitPython.
-
Install CircuitPython v9.1 or greater onto your Pi Pico.
-
In the
lib/
folder on your device copy the following, CircuitPython Libraries,circuitpython_toml
jled-circuitpython
winterbloom_smolmidi
(optionally compile withmpy-cross
)
You can install the first and second dependencies (not
winterbloom_smolmidi
) using thecircup
tool,circup install jled toml
-
Copy all python (
*.py
) files in this folder on to your device. -
Reset the device. Upon first boot, you'll see the
TOMATOBOX
drive, and you can edit the newly generatedsettings.toml
file to your liking.
NOTE: After resetting the device again, the TOMATOBOX
drive will disappear.
To boot the device into "debug" mode (and display the drive again), use the
testing tool linked in the Development section of this document.
Edit settings.toml
and set the button and led pins to match your setup.
### Pins ###
button = "GP17" # Pin number for button
led = "GP16" # Pin number for LED
For additional settings, see settings.toml
generated after you first install
and reset your device.
Receive from the device change control on channel 1 (0xB0
) with purpose
byte general purpose #1 (0x10
) with a value as defined below to register
button presses,
Bytes | Button Press State |
---|---|
0xB0 0x10 0x7F |
Pressed |
0xB0 0x10 0x00 |
Released |
Send to the device change control on channel 1 (0xB0
) with purpose byte
general purpose #2 (0x11
) with a value as defined below to achieve the
following LED control actions,
Bytes | LED Control Action |
---|---|
0xB0 0x11 0x00 |
OFF |
0xB0 0x11 0x01 |
ON (solid) |
0xB0 0x11 0x02 |
Flash (period = 1.0 seconds) |
0xB0 0x11 0x03 |
Pulsate SLOW (period = 2.25 seconds) |
0xB0 0x11 0x04 |
Pulsate FAST (period = 0.6 seconds) |
NOTE: The device will acknowledge a correctly processed LED control change by
returning same message back. For example sending 0xB0 0x11 0x01
to
turn the LED on (solid) will receive 0xB0 0x11 0x01
back, which can be used
to confirm the LED has been turned on (solid).
To restart the device's program, send it the system reset byte (0xFF
). The device
will send back a 0xFF
when it resets or starts up.
Use the files contained in the test/
directory to test. (This is known to work in Google Chrome.)