Skip to content

Instantly share code, notes, and snippets.

@rocketjosh
Created March 10, 2021 18:57
Show Gist options
  • Select an option

  • Save rocketjosh/bcb0fb5b62fcb183b27ee2031aa0bcc7 to your computer and use it in GitHub Desktop.

Select an option

Save rocketjosh/bcb0fb5b62fcb183b27ee2031aa0bcc7 to your computer and use it in GitHub Desktop.
/*
9141 UART test - M2
*/
void setup() {
// initialize both serial ports:
SerialUSB.begin(9600);
Serial1.begin(9600);
pinMode(LIN_KSLP, OUTPUT);
digitalWrite(LIN_KSLP, HIGH);
pinMode(PS_J1850_9141, OUTPUT);
digitalWrite(PS_J1850_9141, HIGH);
delay(1000);
SerialUSB.println("Starting");
pinMode(LIN_KRX, INPUT_PULLUP);
}
void loop() {
while (Serial1.available() > 0) {
int inByte = Serial1.read();
SerialUSB.write(inByte);
}
while (SerialUSB.available() > 0) {
int inByte = SerialUSB.read();
Serial1.write(inByte);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment