Created
August 20, 2026 10:46
-
-
Save SpotlightKid/30ef001161bdd0d1e560e791a22668e8 to your computer and use it in GitHub Desktop.
MIDI Footpedal sending MIDI NoteOn/NoteOff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://github.com/tttapa/Control-Surface | |
| #include <Control_Surface.h> | |
| // Pin mappings | |
| #if 0 | |
| // Xiao RP2040 | |
| #define D1 p27 | |
| #define D2 p28 | |
| #define D3 p29 | |
| #define D4 p6 | |
| #define D5 p7 | |
| #define D6 p0 | |
| #else | |
| // Xiao SAMD21 | |
| #define D1 17 | |
| #define D2 1 | |
| #define D3 0 | |
| #define D4 4 | |
| #define D5 3 | |
| #define D6 15 | |
| #endif | |
| // MIDI over USB interface | |
| USBMIDI_Interface midi; | |
| // Instantiate a Transposer that can transpose from one octave down to one | |
| // octave up | |
| Transposer<-12, +12> transposer; | |
| // Instantiate a Selector to change the transposition | |
| IncrementDecrementSelector<transposer.getNumberOfBanks()> selector { | |
| transposer, | |
| {D6, D5}, | |
| Wrap::Clamp, | |
| }; | |
| // Instantiate an array of NoteButton objects | |
| Bankable::NoteButton buttons[] { | |
| {transposer, D1, MIDI_Notes::C[3]}, | |
| {transposer, D2, MIDI_Notes::E[3]}, | |
| {transposer, D3, MIDI_Notes::F[3]}, | |
| {transposer, D4, MIDI_Notes::G[3]}, | |
| }; | |
| void setup() { | |
| Control_Surface.begin(); | |
| } | |
| void loop() { | |
| Control_Surface.loop(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment