#include <Encoder.h> // Include the Encoder library.
// This must be done before the Control Surface library if you want to use encoders
#include <Control_Surface.h> // Include the Control Surface library
// Instantiate a MIDI over USB interface.
USBMIDI_Interface midi;
// Instantiate an array of NoteButton objects that send
// MIDI note events when a push button is pressed/released
NoteButton buttons[] {
{ 4, MCU::PLAY }, // Push button on pin 4, “play” control
{ 5, MCU::STOP },
{ 6, MCU::RECORD },
{ 7, MCU::REWIND },
{ 8, MCU::FAST_FWD },
};
// Instantiate a CCRotaryEncoder object
CCRotaryEncoder enc {
{2, 3}, // pins
MCU::V_POT_1, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
void setup() {
// Select the correct relative MIDI CC mode:
RelativeCCSender::setMode(relativeCCmode::MACKIE_CONTROL_RELATIVE);
Control_Surface.begin(); // Initialize Control Surface
}
void loop() {
Control_Surface.loop(); // Update the Control Surface
}