/* James Khan Fab Academy networking and communication week week. https://fabacademy.org/2021/labs/vancouver/students/james-khan/assignments/week13/ Used the code I developed for my input week as a starting point and modified for communication. https://fabacademy.org/2021/labs/vancouver/students/james-khan/assignments/week11/ This program is for an SEEED RP2040 board and communicates with my self made ATtiny board (with a different program). This program constantly listens for a message on two seperate serial ports Serial is the regular connection to the computer via USB SErial1 is the UART connection to my second board When a message comes in on either of the serial ports it sends the message on the other serial port. */ void setup() { delay(2000); Serial.begin(115200); // set's up the connection speed, needs to match the other program delay(200); Serial1.begin(115200, SERIAL_8N1); //defines a unique Serial addresses:default Serial is USB/computer, Serial1 is RX/TX or UART Serial.println("\n--- UART communication with XIAO RP2040 ---"); Serial.println("-------------------------------------------------------"); } void loop() { if (Serial.available()) { // If I send anything from the computer's serial monitor Serial1.write(Serial.read()); // then rean it and send it over UART to other device // read it and send it out Serial1 (pins 0 & 1) digitalWrite(29, HIGH); delay(50); digitalWrite(29, LOW); // flashes LED to indicate received sent } if (Serial1.available()) { // If anything comes in Serial1 (my connected second board) Serial.write(Serial1.read()); // then send it to the computer's serial monitor digitalWrite(29, HIGH); delay(50); digitalWrite(29, LOW); // flashes LED to indicate received message } }