Code:
// ******CONSTANT VALUES********
// customize code behaviour here!
const int channel = 1; // MIDI channel
const int A_PINS = 2; // number of Analog PINS
const int D_PINS = 20; // number of Digital PINS
const int ON_VELOCITY = 99; // note-one velocity sent from buttons (should be 65 to 127)
// define the pins you want to use and the CC ID numbers on which to send them..
const int ANALOG_PINS[A_PINS] = {A0,A1};
const int CCID[A_PINS] = {21,22};
// define the pins and notes for digital events
const int DIGITAL_PINS[D_PINS] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,16,17,18,19,20,21};
const int note[D_PINS] = {60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79};
const int BOUNCE_TIME = 5; // 5 ms is usually sufficient
const boolean toggled = true;
//******VARIABLES***********
// a data array and a lagged copy to tell when MIDI changes are required
byte data[A_PINS];
byte dataLag[A_PINS]; // when lag and new are not the same then update MIDI CC value
//************INITIALIZE LIBRARY OBJECTS**************
// not sure if there is a better way... some way run a setup loop on global array??
// use comment tags to comment out unused portions of array definitions
// initialize the ReponsiveAnalogRead objects
ResponsiveAnalogRead analog[]{
{ANALOG_PINS[0],true},
{ANALOG_PINS[1],true},
};
// initialize the bounce objects
Bounce digital[] = {
Bounce(DIGITAL_PINS[0], BOUNCE_TIME),
Bounce(DIGITAL_PINS[1], BOUNCE_TIME),
Bounce(DIGITAL_PINS[2], BOUNCE_TIME),
Bounce(DIGITAL_PINS[3], BOUNCE_TIME),
Bounce(DIGITAL_PINS[4], BOUNCE_TIME),
Bounce(DIGITAL_PINS[5], BOUNCE_TIME),
Bounce(DIGITAL_PINS[6], BOUNCE_TIME),
Bounce(DIGITAL_PINS[7], BOUNCE_TIME),
Bounce(DIGITAL_PINS[8], BOUNCE_TIME),
Bounce(DIGITAL_PINS[9], BOUNCE_TIME),
Bounce(DIGITAL_PINS[10], BOUNCE_TIME),
Bounce(DIGITAL_PINS[11], BOUNCE_TIME),
Bounce(DIGITAL_PINS[12], BOUNCE_TIME),
Bounce(DIGITAL_PINS[13], BOUNCE_TIME),
Bounce(DIGITAL_PINS[16], BOUNCE_TIME),
Bounce(DIGITAL_PINS[17], BOUNCE_TIME),
Bounce(DIGITAL_PINS[18], BOUNCE_TIME),
Bounce(DIGITAL_PINS[19], BOUNCE_TIME),
Bounce(DIGITAL_PINS[20], BOUNCE_TIME),
Bounce(DIGITAL_PINS[21], BOUNCE_TIME),
};