Created
January 12, 2023 17:22
-
-
Save troelskn/0980b71bf4bca37e92b6e5231b2eddc4 to your computer and use it in GitHub Desktop.
Basic example of using Adafruit Featherwing MIDI with a Feather RP2040 board
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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