2021-05-18 11:18:36 +00:00
|
|
|
#include <Arduino.h>
|
2021-05-22 17:06:39 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#define RX1pin 14 // Pin 10 on expansion board
|
|
|
|
#define TX1pin 4 // Pin 11 on expansion board
|
|
|
|
#define RX2pin 15 // Pin 12 on expansion board
|
|
|
|
#define TX2pin 2 // Pin 13 on expansion board
|
|
|
|
|
|
|
|
void forwardprint();
|
|
|
|
|
|
|
|
int counter;
|
|
|
|
String input1, input2;
|
2021-05-18 11:18:36 +00:00
|
|
|
|
|
|
|
void setup() {
|
2021-05-22 17:06:39 +00:00
|
|
|
Serial.begin(115200); // Set up hardware UART 0 (Connected to USB port)
|
|
|
|
Serial1.begin(9600, SERIAL_8N1, RX1pin, TX1pin); // Set up hardware UART 1
|
|
|
|
Serial2.begin(9600, SERIAL_8N1, RX2pin, TX2pin); // Set up hardware UART 2
|
2021-05-18 11:18:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
2021-05-22 17:06:39 +00:00
|
|
|
forwardprint();
|
|
|
|
if(Serial.available()){
|
|
|
|
input1 = String(Serial.readStringUntil('\n'));
|
|
|
|
Serial1.println(input1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void forwardprint() {
|
|
|
|
if(Serial2.available()){
|
|
|
|
input2 = String(Serial2.readStringUntil('\n'));
|
|
|
|
Serial.println(input2);
|
|
|
|
}
|
2021-05-18 11:28:50 +00:00
|
|
|
}
|