From 3b04d1029060a8d6ccc7ddbdde231166767530e2 Mon Sep 17 00:00:00 2001 From: mattmcw Date: Mon, 13 Feb 2023 15:02:40 -0500 Subject: [PATCH] Add softserial_mock sketch to forward serial commands from one arduino to another --- ino/softserial_mock/softserial_mock.ino | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 ino/softserial_mock/softserial_mock.ino diff --git a/ino/softserial_mock/softserial_mock.ino b/ino/softserial_mock/softserial_mock.ino new file mode 100644 index 0000000..17b143d --- /dev/null +++ b/ino/softserial_mock/softserial_mock.ino @@ -0,0 +1,31 @@ +#include + +/** + * 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); + } +} \ No newline at end of file