#include <Control_Surface.h>
USBMIDI_Interface midi;
// Instantiate a transposer that can transpose from 3 octaves up to 3 octaves down.
Transposer<-3, +3> transposer(12);
// Instantiate a Selector to change the transposition. N-O buttons connected between ground and digital pins 14 & 15.
IncrementDecrementSelector<transposer.getNumberOfBanks()> selector = {
transposer,
{14, 15},
Wrap::Clamp,
};
// The note numbers corresponding to the buttons in the matrix
const AddressMatrix<4, 8> midiNoteOns {{
{44, 45, 46, 47, 48, 49, 50, 51},
{52, 53, 54, 55, 56, 57, 58, 59},
{60, 61, 62, 63, 64, 65, 66, 67},
{68, 69, 70, 71, 72, 73, 74, 75},
}};
Bankable::NoteButtonMatrix<4, 8> ButtonMatrix {
transposer, //work fine
{A0,A2,A4,11}, // row pins
{2,3,4,5,6,7,8,9}, // column pinss
midiNoteOns, // address matrix
CHANNEL_1, // channel and cable number
};
const AddressMatrix<4, 8> velKeys {{
{1, 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},
}};
AH::ButtonMatrix<class Derived, 4, 8> velMatrix {
{A1,A3,A5,12}, // row pins
{2,3,4,5,6,7,8,9}, // column pins
};
void onButtonChanged (uint8_t row, uint8_t col, bool state) {
Serial.print("button at [");
Serial.print(col);
Serial.print(",");
Serial.print(row);
Serial.print("] is ");
Serial.println(state ? "ON" : "OFF");
}
// VELOCITY 7-bit filtered analog input for velocity control. 10k pot pin1=ground, pin2=A10, pin3-vcc.
//FilteredAnalog<7> velocityInput = A10;
void setup() {
Serial.begin(115200);
Control_Surface.begin();
// buttonmatrix.setVelocity(100); //Set velocity for all notes.
}
void loop() {
// if (velocityInput.update())
// buttonmatrix.setVelocity(velocityInput.getValue());
Control_Surface.loop();
}
Nothing prints to serial monitor this way...