Mono Jack 6.3 mm to USB using Arduino to send midi CC
Topic: Mono Jack 6.3 mm to USB using Arduino to send midi CC
(Read 2919 times)
Always making something...
Re: Mono Jack 6.3 mm to USB using Arduino to send midi CC
Dec 27, 2017, 12:37 am
: Dec 27, 2017, 12:42 am by pjrc
Before you connect to any pins, get a multimeter to do some simple tests.
The very first test is the measure the voltages when the buttons are pressed and not pressed. That pedal takes a 9 volt battery. The very first thing you want to learn is whether it's sending you 9 volts when you press (or don't press) the buttons. If this thing sends you voltages, then you're going to need to do more work to connect it safely to an Arduino or Teensy.
DO NOT CONNECT DIRECTLY if the plug measures 9 volts!
If you get no voltage at all (except perhaps very minor fluctuations when you touch the wires), then switch to resistance/ohms measurement. It's possible the wires just connect to switches. In that case, you'd expect to see infinite (or over / overload) ohms in one state and close to zero ohms in the other state. If this is how the pedal works, then you can connect each switch directly to a digital pin and use pinMode(pin, INPUT_PULLUP).
Whichever way things work, I highly recommend using the Bounce library to read the pins. You can use digitalRead(), but then you have to do quite a bit of extra work to deal with the mechanical chatter in the switches. The Bounce lib does all that for you. Especially with MIDI, you want clean signals so you can transmit only 1 MIDI message when the button presses, and perhaps another when it releases, so do yourself a favor and use the Bounce lib.
If using Teensy (and you've installed Teensyduino), click
File > Examples > Teensy > USB_MIDI > Buttons
to get started with a MIDI example using Bounce. The comments in that code explain how it works. If you wanted something other than note on/off, just change the MIDI messages.