Take a look at this thread
https://forum.loopyapp.com/discussion/419/homemade-teensyduino-pedal-works-well-with-loopyYou can either run it as an USB keyboard, where button presses send keystrokes, or as USB MIDI, where button presses send CC or key on/off messages.
I can help you adapt the code examples linked there to whatever hardware configuration you're interested in building.