Add softserial_mock sketch to forward serial commands from one arduino to another

This commit is contained in:
Matt McWilliams 2023-02-13 15:02:40 -05:00
parent c16233dfda
commit 3b04d10290
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
#include <SoftwareSerial.h>
/**
* CONSTANTS
**/
#define rSignal 7
#define tSignal 8
const int serialDelay = 5;
SoftwareSerial softSerial (rSignal, tSignal);
volatile char cmdChar = 'z';
void setup() {
Serial.begin(57600);
Serial.flush();
Serial.setTimeout(serialDelay);
softSerial.begin(9600);
softSerial.flush();
softSerial.setTimeout(serialDelay);
}
void loop () {
if (Serial.available()) {
cmdChar = (char)Serial.read();
softSerial.write(cmdChar);
}
}