iŽve found a piece of code, that has easy possibilities to edit the analogue (max. 16) an digital (max.68 ..the arduino only has 52 pins??) inputs on the arduino mega boards ..it should work with teensys too.
This is the page on instructables with an tutorial how to build an complete controller with arduino. If you want to, you could use the midifighter mappings from djtt with your diy controller (if youŽve connected the buttons like its been described in the code) because the arduino will send the same Commands as the "real" midifighter
To Connect your specific Inputs you just have to edit the Numbers (for the digitial inputs the 52 and for analogue inputs the 16) in this part of the Code:
Code:
#if defined(ARDUINO_MEGA)
// Number of digital inputs. Can be anywhere from 0 to 68.
#define NUM_DI 52
// Number of analogue inputs. Can be anywhere from 0 to 16.
#define NUM_AI 16
And also the Numbers of the Pins on the Board:
Digital Line:
(e.g. if you have one button only the 2 will last for the digital Inputs)
Code:
#if defined(ARDUINO_MEGA)
#define DIGITAL_PIN_ORDER 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53
Analogue Line:
(e.g. if you have one Pot, only the A0 will last for the analouge Inputs)
Code:
#if defined(ARDUINO_MEGA)
#define ANALOGUE_PIN_ORDER A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15
At the moment iŽve tested it with one pot and one button on my arduino mega -> works great!... in the next two weeks i desolder my diy controller and connect al the buttons and potis to the arduino.. IŽll let you know how it works
Because of the length of the code i couldnŽt post it directly here, you could easily download it from the instructables page..
Regards!
Bookmarks