Im pretty new at this but have been doing a lot a research and can't find anything that works with what I'm trying to do... what i am wanting is, for example, 8 buttons in total, 2 are banks, up and down. 6 are midi notes and each bank to have a new set of midi notes for the 6 buttons that are for the midi notes..
this is a simple version of what i already have but it does work. what i am needing is away to put it into a bank and then repeat what I've already got done..
#include <Bounce.h>
// the MIDI channel number to send messages
const int channel = 1;
// Create Bounce objects for each button. The Bounce object
// automatically deals with contact chatter or "bounce", and
// it makes detecting changes very simple.
Bounce button14 = Bounce(14, 100);
Bounce button15 = Bounce(15, 100); // 5 = 5 ms debounce time
Bounce button2 = Bounce(2, 10); // which is appropriate for good
Bounce button3 = Bounce(3, 10); // quality mechanical pushbuttons
Bounce button4 = Bounce(4, 10);
Bounce button5 = Bounce(5, 10); // if a button is too "sensitive"
Bounce button6 = Bounce(6, 200); // to rapid touch, you can
Bounce button7 = Bounce(7, 10); // increase this time.
Bounce button8 = Bounce(8, 10);
Bounce button9 = Bounce(9, 10);
Bounce button10 = Bounce(10, 10);
Bounce button11 = Bounce(11, 10);
Bounce button12= Bounce(12, 10);
void setup() {
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP); // Teensy++ 2.0 LED, may need 1k resistor pullup
pinMode(7, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP);
pinMode(9, INPUT_PULLUP);
pinMode(10, INPUT_PULLUP);
pinMode(11, INPUT_PULLUP);
pinMode(12, INPUT_PULLUP);
pinMode(13, INPUT_PULLUP);
pinMode(14, INPUT_PULLUP); //channel 1
pinMode(15, INPUT_PULLUP); // channel 2 Teensy 2.0 LED, may need 1k resistor pullup
}
void loop() {
button14.update();
button15.update();
button2.update();
button3.update();
button4.update();
button5.update();
button6.update();
button7.update();
button8.update();
button9.update();
button10.update();
button11.update();
button12.update();
if (button14.fallingEdge()) {
usbMIDI.sendNoteOn(60, 99, channel); // 60 = C4
}
delay(50);
if (button14.risingEdge()) {
usbMIDI.sendNoteOff(60, 0, channel); // 60 = C4
}
}