Good day, I'm starting a MIDI console project and I've copied the "MIDI-Controller-Finished-Example" code as an example. I was able to assign the 4 faders and the pan pots using MIDI Learn but I have a few items not working right.
1.I assigned the 4 buttons but they work just once. I removed the reference to the [MCU::MUTE_1] for that didn't seem to work.
2. The encoder has 5 pins (VCC, GND, S1, S2, Key) put the code has only 2 pins assigned.
3. Also the button to select bank doesn't seem to work.
How does one set up the MCU? I'm working with Logic Pro X.
Here the code:
#include <Control_Surface.h>
USBMIDI_Interface usbmidi;
// If the jog wheels or other encoders are too slow in your software, increase
// this value.
// (It will be multiplied with the actual speed of the encoder, as the name
// implies.) Default is 1.
const int speedMultiplier = 1;
//
Bank<2> bank(4); // A bank with four channels, and 2 bank settings
Bankable::CCPotentiometer faders[] {
{{bank, BankType::CHANGE_CHANNEL}, A0, {MIDI_CC::Channel_Volume, CHANNEL_1}},
{{bank, BankType::CHANGE_CHANNEL}, A1, {MIDI_CC::Channel_Volume, CHANNEL_2}},
{{bank, BankType::CHANGE_CHANNEL}, A2, {MIDI_CC::Channel_Volume, CHANNEL_3}},
{{bank, BankType::CHANGE_CHANNEL}, A3, {MIDI_CC::Channel_Volume, CHANNEL_4}},
};
//CCPotentiometer knobsTop[] {
// {A4, 0x10},
// {A5, 0x11},
// {A6, MIDI_CC::General_Purpose_Controller_3},
// {A7, MIDI_CC::General_Purpose_Controller_4},
//};
//
Bankable::CCPotentiometer knobsSide[] {
{{bank, BankType::CHANGE_CHANNEL}, A4, {MIDI_CC::Pan, CHANNEL_1}},
{{bank, BankType::CHANGE_CHANNEL}, A5, {MIDI_CC::Pan, CHANNEL_2}},
{{bank, BankType::CHANGE_CHANNEL}, A6, {MIDI_CC::Pan, CHANNEL_3}},
{{bank, BankType::CHANGE_CHANNEL}, A7, {MIDI_CC::Pan, CHANNEL_4}},
};
//
Bankable::NoteButtonLatching switches[] {
{{bank, BankType::CHANGE_ADDRESS}, 2, {0x10, CHANNEL_1}},
{{bank, BankType::CHANGE_ADDRESS}, 3, {0x11, CHANNEL_2}},
{{bank, BankType::CHANGE_ADDRESS}, 5, {0x12, CHANNEL_3}},
{{bank, BankType::CHANGE_ADDRESS}, 7, {0x13, CHANNEL_4}},
};
CCRotaryEncoder enc {
{1, 0}, // pins
MIDI_CC::General_Purpose_Controller_5, // address
speedMultiplier, // multiplier
4, // pulses per click
};
SwitchSelector selector {bank, 11};
//
void setup() {
Control_Surface.begin();
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() { // Refresh all inputs
Control_Surface.loop();
digitalWrite(LED_BUILTIN, digitalRead(11));
}