Control Surface  1.2.0
MIDI Control Surface library for Arduino
NoteButtonMatrix.ino

NoteButtonMatrix

This examples shows how to use a button matrix to read many switches.

Boards:
AVR, AVR USB, Nano Every, Due, Nano 33, Teensy 3.x, ESP32

Connections

Connect a 4 × 3 matrix of buttons with the rows to pins 2, 3, 4 and 5, and the columns to pins 6, 7 and 8.

Pull-up resistors are not necessary, because the internal ones will be used.

If you want to be able to press multiple buttons at once, add a diode in series with each button:

Behavior

When you press one of the buttons, a note on event for the corresponding note is sent, when you release it, a note off event is sent.

Mapping

The note numbers are specified in the addresses array. Map accordingly in your DAW or DJ software.

Written by Pieter P, 24/09/2017
https://github.com/tttapa/Control-Surface

// The note numbers corresponding to the buttons in the matrix
const AddressMatrix<4, 3> addresses = {{
{1, 2, 3},
{4, 5, 6},
{7, 8, 9},
{10, 11, 12},
}};
NoteButtonMatrix<4, 3> buttonmatrix = {
{2, 3, 4, 5}, // row pins
{6, 7, 8}, // column pins
addresses, // address matrix
CHANNEL_1, // channel and cable number
};
void setup() {
}
void loop() {
}
USBMIDI_Interface
A class for MIDI interfaces sending MIDI messages over a USB MIDI connection.
Definition: USBMIDI_Interface.hpp:41
NoteButtonMatrix
A class of MIDIOutputElements that read the input from a matrix of momentary push buttons or switches...
Definition: NoteButtonMatrix.hpp:27
Control_Surface.h
The main header file that includes all Control-Surface header files.
Control_Surface_::loop
void loop()
Update all MIDI elements, send MIDI events and read MIDI input.
Definition: Control_Surface_Class.cpp:68
Control_Surface
Control_Surface_ & Control_Surface
A predefined instance of the Control Surface to use in the Arduino sketches.
Definition: Control_Surface_Class.cpp:203
AddressMatrix
Array2D< uint8_t, nb_rows, nb_cols > AddressMatrix
Definition: Def.hpp:27
CHANNEL_1
constexpr Channel CHANNEL_1
Definition: Channel.hpp:111
Control_Surface_::begin
void begin()
Initialize the Control_Surface.
Definition: Control_Surface_Class.cpp:25