Control Surface master
MIDI Control Surface library for Arduino


This is the second example used in the 'Getting Started' guide:

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

Written by PieterP, 2018-08-29

// Include the library
// Instantiate a MIDI Interface to use
// Instantiate a shift register as output for the LEDs
SPIShiftRegisterOut<8> sreg {
SPI, // SPI interface to use
10, // Latch pin (ST_CP)
MSBFIRST, // Byte order
// Create an array of LEDs that listen to MIDI Note messages, turning on and off
// the LEDs connected to the eight output pins of the shift register
NoteLED leds[] {
{, MIDI_Notes::C(4)}, // LED pin, address (note number, channel, cable)
{, MIDI_Notes::D(4)}, //
{, MIDI_Notes::E(4)}, //
{, MIDI_Notes::F_(4)}, // F is an exception :(
{, MIDI_Notes::G(4)}, //
{, MIDI_Notes::A(4)}, //
{, MIDI_Notes::B(4)}, //
{, MIDI_Notes::C(5)}, //
// Initialize the Control Surface
void setup() {
// Update the Control Surface
void loop() {
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.
void begin()
Initialize the Control_Surface.
void loop()
Update all MIDI elements, send MIDI events and read MIDI input.
Generic base class for classes that listen for MIDI Note, Control Change and Key Pressure events on a...
Definition: NoteCCKPLED.hpp:20
A class for MIDI interfaces sending MIDI messages over a USB MIDI connection.
constexpr Note F_
F (Fa)
Definition: Notes.hpp:45
constexpr Note G
G (Sol)
Definition: Notes.hpp:47
constexpr Note E
E (Mi)
Definition: Notes.hpp:44
constexpr Note B
B (Si)
Definition: Notes.hpp:51
constexpr Note A
A (La)
Definition: Notes.hpp:49
constexpr Note C
C (Do)
Definition: Notes.hpp:40
constexpr Note D
D (Re)
Definition: Notes.hpp:42