This is the (not quite finished, still need to assign cc values that i need) code. Its pretty basic. I cant imagine ever wanting to go back to doing it the old way, it would just feel like banging rocks together.
//===============================================================================
// Header Files
//===============================================================================
#include <Control_Surface.h> // Include the Control Surface library
// Instantiate a Serial MIDI interface at the default MIDI baud rate.
//USBDebugMIDI_Interface midi = {115200};
// Select the serial port to use.
auto &serial = Serial;
// Instantiate a Serial MIDI interface at the default MIDI baud rate.
SerialMIDI_Interface<decltype(serial)> midi = {serial, MIDI_BAUD};
AnalogMultiplex<4> fader_mux = {
A0, // Analog input pin
{2,3,4} // Address pins S0, S1, S2
};
AnalogMultiplex<4> pot_mux = {
A1, // Analog input pin
{2,3,4} // Address pins S0, S1, S2
};
using namespace MIDI_Notes;
CCPotentiometer faderArray[] = {
{A3, {102, CHANNEL_1}},
{A2, {103, CHANNEL_1}},
{fader_mux.pin(7), {104, CHANNEL_1}},
{fader_mux.pin(3), {105, CHANNEL_1}},
{fader_mux.pin(0), {106, CHANNEL_1}},
{fader_mux.pin(1), {107, CHANNEL_1}},
{fader_mux.pin(2), {108, CHANNEL_1}},
{fader_mux.pin(4), {109, CHANNEL_1}},
{fader_mux.pin(6), {110, CHANNEL_1}},
{fader_mux.pin(5), {111, CHANNEL_1}},
};
CCPotentiometer potArray[] = {
{pot_mux.pin(1), {20, CHANNEL_1}},
{pot_mux.pin(0), {21, CHANNEL_1}},
{pot_mux.pin(3), {22, CHANNEL_1}},
{A4, {23, CHANNEL_1}},
{A5, {24, CHANNEL_1}},
{pot_mux.pin(2), {25, CHANNEL_1}},
{pot_mux.pin(4), {26, CHANNEL_1}},
{pot_mux.pin(6), {27, CHANNEL_1}},
{pot_mux.pin(7), {28, CHANNEL_1}},
{pot_mux.pin(5), {29, CHANNEL_1}},
};
// Instantiate a CCIncrementDecrementButtons object
CCIncrementDecrementButtons buttons = {
{5, 6}, // Button pins: 5 increments, 6 decrements
30, // Increment/Decrement CC address
1, // Multiplier
31, // Reset note address
};
// Instantiate a CCButton object
CCButton button = {
// Push button on pin 7:
7,
// General Purpose Controller #1 on MIDI channel 1:
{MIDI_CC::General_Purpose_Controller_1, CHANNEL_1},
};
void setup()
{
Control_Surface.begin(); // Initialize the Control Surface
}
void loop()
{
Control_Surface.loop();
}