Created
July 18, 2025 19:33
-
-
Save tecteun/60633ea2084782a55070175466b1fc50 to your computer and use it in GitHub Desktop.
XIAO MIDI Synthesizer RP2040 USB midi
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 <Arduino.h> | |
#include <Adafruit_TinyUSB.h> | |
#include <MIDI.h> | |
#include "SAM2695Synth.h" | |
#include <SoftwareSerial.h> | |
SoftwareSerial SSerial(D7, D6); // RX, TX | |
#define COM_SERIAL SSerial | |
SAM2695Synth<SoftwareSerial> synth = SAM2695Synth<SoftwareSerial>::getInstance(); | |
// USB MIDI object | |
Adafruit_USBD_MIDI usb_midi; | |
void setup() { | |
usb_midi.begin(); | |
SSerial.begin(31250); | |
} | |
void loop() { | |
uint8_t packet[4]; | |
if(usb_midi.available() > 0){ | |
usb_midi.readPacket(packet); | |
SSerial.write(packet, 4); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment