It has been a while since I build something and it seems Im a little rusty.
I want to make a new midi foot controller. I managed to build one with an arduino mega but now i want to build one with a pro micro. That has native usb.
I have made a foot controller with nine buttons. 8 of those buttons send midi messages. NoteOn an NoteOff, from c4 to c5. I used the code from MIDI_controller/Ex.02.Button.ino at master · tttapa/MIDI_controller · GitHub
/*
This is an example of the "Digital" class of the MIDI_controller library.
Connect a push buttons to digital pin 2. Connect the other pin of the button to the ground,
a pull-up resistor is not necessary, because the internal one will be used.
This button will play MIDI note C4 when pressed.
Map it in your DAW or DJ software.
Written by tttapa, 08/09/2017
https://github.com/tttapa/MIDI_controller
*/
#include <MIDI_Controller.h> // Include the library
const uint8_t velocity = 0b1111111; // Maximum velocity (0b1111111 = 0x7F = 127)
const uint8_t c4 = 60; // Note number 60 is defined as middle C in the MIDI specification
const uint8_t d4 = 62;
const uint8_t e4 = 64;
const uint8_t f4 = 65;
const uint8_t g4 = 67;
const uint8_t a4 = 69;
const uint8_t b4 = 70;
const uint8_t c5 = 72;
// Create a new instance of the class 'Digital', called 'button', on pin 2, that sends MIDI messages with note 'C4' (60) on channel 1, with velocity 127
Digital button(2, c4, 1, velocity);
Digital button(3, d4, 1, velocity);
Digital button(4, e4, 1, velocity);
Digital button(5, f4, 1, velocity);
Digital button(6, g4, 1, velocity);
Digital button(7, a4, 1, velocity);
Digital button(8, b4, 1, velocity);
Digital button(9, c5, 1, velocity);
void setup() {}
void loop() {
// Refresh the button (check whether the button's state has changed since last time, if so, send it over MIDI)
MIDI_Controller.refresh();
}
So that was easy. But i would like my ninth button to act like a channel changer. So when i press button 9. The other buttons 1-8 choose the channel and then after i choose it returns to the first mode in which i can play the notes in a different channel.
How would i do that?