Control Surface master
MIDI Control Surface library for Arduino
MIDI-Controller-Finished-Example.ino

MIDI-Controller-Finished-Example

This is the code I used for my specific MIDI controller.

Boards:
Leonardo

Connections

I used an Arduino Leonardo with:

Behavior

Mapping

Create a custom mapping using the MIDI learn option in your DAW.

Written by PieterP, 07-09-2017 https://github.com/tttapa/Control-Surface

// 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
};
CCPotentiometer knobsTop[] {
};
};
};
{1, 0}, // pins
speedMultiplier, // multiplier
4, // pulses per click
};
SwitchSelector selector {bank, 11};
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() { // Refresh all inputs
digitalWrite(LED_BUILTIN, digitalRead(11));
}
constexpr PinMode_t OUTPUT
@ CHANGE_CHANNEL
Change the offset of the channel number of the element.
Definition: BankConfig.hpp:21
@ CHANGE_ADDRESS
Change the offset of the address (i.e.
Definition: BankConfig.hpp:17
constexpr Channel CHANNEL_2
Definition: Channel.hpp:119
constexpr Channel CHANNEL_1
Definition: Channel.hpp:118
constexpr Channel CHANNEL_3
Definition: Channel.hpp:120
constexpr Channel CHANNEL_4
Definition: Channel.hpp:121
The main header file that includes all Control-Surface header files.
Control_Surface_ & Control_Surface
A predefined instance of the Control Surface to use in the Arduino sketches.
A class that groups Bankable MIDI Output Elements and Bankable MIDI Input Elements,...
Definition: Bank.hpp:91
A class of MIDIOutputElements that read the analog input from a potentiometer or fader,...
A class of MIDIOutputElements that read the input of a latching push button or toggle switch,...
A class of MIDIOutputElements that read the analog input from a potentiometer or fader,...
A class of MIDIOutputElements that read the input of a quadrature (rotary) encoder and send out relat...
void begin()
Initialize the Control_Surface.
void loop()
Update all MIDI elements, send MIDI events and read MIDI input.
Selector that selects one of two settings, based on the state of a toggle or momentary switch.
A class for MIDI interfaces sending MIDI messages over a USB MIDI connection.
void pinMode(pin_t pin, PinMode_t mode)
An ExtIO version of the Arduino function.
PinStatus_t digitalRead(pin_t pin)
An ExtIO version of the Arduino function.
void digitalWrite(pin_t pin, PinStatus_t val)
An ExtIO version of the Arduino function.
constexpr uint8_t MUTE_1
Mute 1 (In/Out)
Definition: MCU.hpp:40
constexpr uint8_t MUTE_4
Mute 4 (In/Out)
Definition: MCU.hpp:43
constexpr uint8_t MUTE_2
Mute 2 (In/Out)
Definition: MCU.hpp:41
constexpr uint8_t MUTE_3
Mute 3 (In/Out)
Definition: MCU.hpp:42
constexpr uint8_t General_Purpose_Controller_5
constexpr uint8_t General_Purpose_Controller_3
constexpr uint8_t Pan
constexpr uint8_t General_Purpose_Controller_1
constexpr uint8_t Channel_Volume
constexpr uint8_t General_Purpose_Controller_2
constexpr uint8_t General_Purpose_Controller_4