The mapping tried to make use of as much of one for an existing controller as possible, just switched to a different channel.



You’ll want to go over to the Arduino playground and pick up the debounce library Bounce.h to include. It’s a very handy way to easily debounce mass inputs as demonstrated below.



I think the comments and naming make everything pretty clear as to what’s going on. I’ve even left in some junk that was really only part of the development and debugging. The line Serial.begin(38400) is one of these things. It doesn’t need to be there for the code to function. It was just used for the Arduino debugging statements that are now commented out.



If you’re not familiar with Teensy, there’s a good primer on the PJRC site. The most important thing if you’re going to be using the Arduino environment is the Teensy Loader. Be sure that Board and USB Type in the Arduino IDE Tools menu are set correctly as in the image.



Possible changes you may want to make in the code:



* The MIDI channel that the PacMod responds to is midi_ch if you want it to be something other than 3.



* The scaling of the analog pin value in relation to the desired MIDI cc value is analog_scale, set to a value of 8 in the code to give a range of 0 to 128. To change it change analog_scale to ( 1024 / yourDesiredMaxValue ). If you change analog_scale you may also need to change analog_threshold, which is the amount of change on a Teensy analog pin that constitutes sending a MIDI message.



* The MIDI note numbers that are triggered by the buttons are outlined in the array digital_note[] so changing these values will change which notes are mapped to which buttons.



* The MIDI continuous controller numbers mapped to to pots are in array analog_control[] so you can change these as well.



