Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
MIDI-Output.ino

MIDI-Output

This is an example on how to send MIDI messages.

Boards: 🛈
AVR, AVR USB, Nano Every, Due, Nano 33 IoT, Nano 33 BLE, UNO R4, Pi Pico, Teensy 3.x, ESP32, ESP8266

For a full list of available MIDI send functions, see MIDI_Sender.

Connections

None.

Behavior

Mapping

None.

Written by PieterP, 2020-06-11
https://github.com/tttapa/Control-Surface

#include <Control_Surface.h> // Include the Control Surface library
// The MIDI over USB interface to use
void setup() {
midi.begin(); // Initialize the MIDI interface
}
// MIDI note number, channel, and velocity to use
const MIDIAddress address {MIDI_Notes::C[4], Channel_1};
const uint8_t velocity = 0x7F;
void loop() {
midi.sendNoteOn(address, velocity);
delay(500);
midi.sendNoteOff(address, velocity);
delay(500);
midi.update(); // Handle or discard MIDI input
}
constexpr Channel Channel_1
Definition Channel.hpp:118
The main header file that includes all Control-Surface header files.
void update() override
Poll the backend (if necessary) and invoke the callbacks for any received MIDI messages,...
void begin() override
Initialize.
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
void sendNoteOn(MIDIAddress address, uint8_t velocity)
Send a MIDI Note On event.
void sendNoteOff(MIDIAddress address, uint8_t velocity)
Send a MIDI Note Off event.
A class for MIDI interfaces sending MIDI messages over a USB MIDI connection.
constexpr Note C
C (Do)
Definition Notes.hpp:56