/*
Simple Chat Program Receives from the hardware serial, sends to hardware & software serial. Receives from software serial, sends to hardware serial. The circuit: * RX is digital pin PB2 (connect to TX of other device) * TX is digital pin MOSI (connect to RX of other device) created 16 August 2014 modified 16 August 2014 by William Chang Wei Tan based on SoftwareSerial example modified by Pamela M April 30 2019 */ #include SoftwareSerial chat(10, 11); // RX, TX int text; void setup() { // open hardware serial, TX = 1, RX = 0 Serial.begin(9600); Serial.println("Starting Chat Program..."); // set the data rate for the SoftwareSerial port chat.begin(9600); delay(1000); // delay 1s to stabilize serial ports chat.println("chat with me amigo"); } void loop() { if (chat.available()) Serial.write(chat.read()); if (Serial.available()) { Serial.print("Sarduino 1:"); while (Serial.available()) { text = Serial.read(); chat.write(text); Serial.write(text); } chat.println(); Serial.println(); } }