Here's the code I wrote:
#include "Keyboard.h"
const char FUNCTION_F14 = 0xF1;
int down = 0;
void setup() {
// make pin 2 an input and turn on the
// pullup resistor so it goes high unless
// connected to ground:
pinMode(2, INPUT_PULLUP);
// initialize control over the keyboard:
Keyboard.begin();
}
void loop() {
int nowDown = digitalRead(2) == LOW;
if (down != nowDown) {
down = nowDown;
if (down) {
Keyboard.press(FUNCTION_F14);
} else {
Keyboard.release(FUNCTION_F14);
}
}
}
Note that the #include was meant to use angle brackets, but Lemmy ate them. If this doesn't work, change it back to angle brackets around the Keyboard.h instead of quotes.
Also, the parts I used:
- https://vi.aliexpress.com/item/1005003583458697.html
- https://vi.aliexpress.com/item/32846843498.html
I wired it up like in the photo, and just laid it on a bed of hot glue so the USB port sticks out the hole. I had intended to get a mini USB extension cable inside the pedal, but the one I ordered turned up defective, and this worked out just fine.

