Description
Features- 4 Banks
- 20 programmable arcade buttons with switchable bank buttons to give you remappable hotcues/instant doubles
- 7 assignable potentiometers
- 1 assignable slide potentiometer
- Dedicated Bank Select buttons
- USB-powered; no power adapter required while functioning as a MIDI Controller
Specifications
Dimension: 32cm x 25cm x 5cm
Optional 9V 1A Arduino power supply
Code
#include <Control_Surface.h>
#include <AH/STL/algorithm> // std::any_of
USBMIDI_Interface midi; // MIDI Interface to use
Bank<4> bank(20);
// Create a new bank selector that changes the bank setting of the bank we just
// created.
// It has push buttons connected to pins 21 and 20 that increment or decrement
// the bank setting, and 4 LEDs to pins 46, 48, 50, 52 that display the current
// bank setting.
IncrementDecrementSelectorLEDs<4> bankSelector = {
bank,
{35, 37}, // button pins
{39, 41, 43, 45}, // LED pins
};
using namespace MIDI_CC;
Bankable::CCPotentiometer potentiometers[] = {
{bank, A4, {0x4A, CHANNEL_1}},
{bank, A5, {0x4B, CHANNEL_1}},
{bank, A6, {0x4C, CHANNEL_1}},
{bank, A7, {0x4D, CHANNEL_1}},
{bank, A8, {0x4E, CHANNEL_1}},
{bank, A9, {0x4F, CHANNEL_1}},
{bank, A10, {0x50, CHANNEL_1}},
{bank, A11, {0x51, CHANNEL_1}},
};
Bankable::NoteButton muteButtons[] = {
{bank, 13, 0x14},
{bank, 12, 0x15},
{bank, 11, 0x16},
{bank, 10, 0x17},
{bank, 9, 0x18},
{bank, 8, 0x19},
{bank, 14, 0x1A},
{bank, 15, 0x1B},
{bank, 16, 0x1C},
{bank, 17, 0x1D},
{bank, 18, 0x1E},
{bank, 19, 0x1F},
{bank, 20, 0x20},
{bank, 21, 0x21},
{bank, 23, 0x22},
{bank, 25, 0x23},
{bank, 27, 0x24},
{bank, 29, 0x25},
{bank, 31, 0x26},
{bank, 33, 0x27},
};
constexpr pin_t ledPin = 47;
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //
void setup() {
Control_Surface.begin();
pinMode(ledPin, OUTPUT);
}
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //
void loop() {
Control_Surface.loop();
// Function that checks if a given button is pressed
auto checkButtonPressed = [](const Bankable::NoteButton &button) {
return button.getButtonState() == Button::Pressed;
};
// If any of the push buttons is pressed
bool pressed = std::any_of(std::begin(muteButtons), std::end(muteButtons),
checkButtonPressed);
// Turn on the LED
digitalWrite(ledPin, pressed);
}