Skip to content

Instantly share code, notes, and snippets.

@2xAA
Created October 1, 2021 11:09
Show Gist options
  • Save 2xAA/d4c057d99ff3f5ee1efa670abf5a9e73 to your computer and use it in GitHub Desktop.
Save 2xAA/d4c057d99ff3f5ee1efa670abf5a9e73 to your computer and use it in GitHub Desktop.
Alternate firmware for genMDM devices to work as a Port 2 Serial cable for rhargreaves/mega-drive-midi-interface
#include <SoftwareSerial.h>
SoftwareSerial softSerial(11, 2);
void setup()
{
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for Native USB only
}
softSerial.begin(4800);
}
void loop()
{
if (Serial.available()) { // If anything comes in Serial (USB),
softSerial.write(Serial.read()); // read it and send it out softSerial (pins 11 & 2)
}
if (softSerial.available()) { // If anything comes in softSerial (pins 11 & 2)
Serial.write(softSerial.read()); // read it and send it out Serial (USB)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment