Skip to content

Instantly share code, notes, and snippets.

@troelskn
Created January 12, 2023 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save troelskn/0980b71bf4bca37e92b6e5231b2eddc4 to your computer and use it in GitHub Desktop.
Save troelskn/0980b71bf4bca37e92b6e5231b2eddc4 to your computer and use it in GitHub Desktop.
Basic example of using Adafruit Featherwing MIDI with a Feather RP2040 board
#include <MIDI.h>
#include <HardwareSerial.h>
struct MIDISettings : public midi::DefaultSettings
{
static const long BaudRate = 31250;
};
MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial1, MIDI, MIDISettings);
void setup()
{
MIDI.begin(MIDI_CHANNEL_OMNI); // Listen on any channel
}
void loop()
{
MIDI.sendNoteOn(42, 127, 1); // Send a Note (pitch 42, velo 127 on channel 1)
delay(1000); // Wait for a second
MIDI.sendNoteOff(42, 0, 1); // Stop the note
delay(1000); // Wait for a second
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment