Control Surface main
MIDI Control Surface library for Arduino


This is an example that demonstrates the use of Increment and Decrement buttons that can be used for scrolling through a song list, tuning effects, etc.
You can compare it to a rotary encoder, but with two buttons instead of an encoder.

AVR, AVR USB, Nano Every, Due, Nano 33 IoT, Nano 33 BLE, Pi Pico, Teensy 3.x, ESP32, ESP8266


The internal pull-up resistors for the buttons will be enabled automatically.


Map the Arduino as a Mackie Control Universal (MCU) or equivalent in your audio software.

Written by PieterP, 2019-01-26

#include <Control_Surface.h> // Include the Control Surface library
// Instantiate a MIDI over USB interface.
// Instantiate a CCIncrementDecrementButtons object
{5, 6}, // Button pins: 5 increments, 6 decrements
MCU::V_POT_1, // Increment/Decrement CC address
1, // Multiplier
MCU::V_POT_SELECT_1, // Reset note address
void setup() {
// Use the Mackie Control protocol for sending relative MIDI CC messages.
Control_Surface.begin(); // Initialize Control Surface
void loop() {
Control_Surface.loop(); // Update the control surface
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.
Relative mode used by the Mackie Control Universal protocol.
A class of MIDIOutputElements that read the input of two momentary push buttons to increment or decre...
void begin()
Initialize the Control_Surface.
void loop()
Update all MIDI elements, send MIDI events and read MIDI input.
static void setMode(relativeCCmode mode)
Set the relative CC mode that's used.
A class for MIDI interfaces sending MIDI messages over a USB MIDI connection.
constexpr uint8_t V_POT_1
V-Pot 1 (Relative) (Out)
Definition: MCU.hpp:166
constexpr uint8_t V_POT_SELECT_1
V-Pot select 1 (In/Out)
Definition: MCU.hpp:58