I agree. I would definitely recommend the use of MIDI here too.
How can I use the Serial Opcode to trigger a sound from an Arduino?
Just letting you know I have a leonardo showing up as a midi human interface device with my code flashed. You have to include some dependencies for it to work, at first my code built and flashed but didnāt show up as a midi HID, then I fiddled about a bit, then the problem below came and bit me, then it worked and I have
[lorien@h2 ~]$ aseqdump -l
Port Client name Port name
0:0 System Timer
0:1 System Announce
14:0 Midi Through Midi Through Port-0
20:0 Arduino Leonardo Arduino Leonardo MIDI 1
My advice is be careful with leonardos though, instead of having separate chips for USB and micro-controller itās one chip for both. All sorts of craziness to do with permissions, the only way I can flash the bloody thing from linux is running the arduino ide as root, because it has to reset the leonardo prior to an upload, and during those instants after a reset the permissions change- changing the serial port permissions does nothing because they change again anyway in the moments before a reflash. No option but flash as root.
Anyway Iāll make another topic once Iāve sorted it all out a bit more.
@rorywalsh this is re-written after figuring out why nothing was working.
The midi library depends on one called USB-MIDI as a transport layer, which in turn depends on MIDIUSB, the official arduino library. When I linked MIDIUSB the device shows up as a midi HID. But it doesnāt actually send any midi messages at all. Itās a horrible and confusing mess thatās totally locked up my machine repeatedly as Iāve fiddled.
Turns out what you need to do is use another macro to create the midi port. It looks like this
#include <MIDIUSB.h>
#include <USB-MIDI.h>
#include <MIDI.h>
/*other code*/
USBMIDI_CREATE_DEFAULT_INSTANCE();
I was creating the wrong kind of midi port by using MIDI_CREATE_DEFAULT_INSTANCE so it wasnāt sending any messages via usb.
I have a working footpedal now
Later edit: and having wires soldered straight to the leonardo which is enclosed in a grounded steel case thereās FAR less noise in the system, the pot is behaving way better than on prototyping board, after tweaking those template params a little Iām getting full 10-bit resolution whilst sampling at 500Hz with barely any chatter.
Nice one. Iāve a feeling Iāll be returning to this next semester in my interactive systems class