Hello,
I am trying to use software serial port using esp8266. I try to send message from pin 5 same message read pin 16 and show in my pc port monitor, but program is not working. Maybe somebody have suggest why it is not working My program:
the following code using the default softwareSerial library using pins D5 and D6
// ESP8266 SoftwareSerial test
#include <SoftwareSerial.h>
#define baudrate 115200//57600//38400//9600//115200
// pins Rx D5 (14) and Tx D6(12)
//SoftwareSerial mySerial(14, 12); // RX, TX
SoftwareSerial mySerial(D5, D6); // RX, TX
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial) { }
Serial.println();
Serial.println("ESP SoftwareSerial test!");
// set the data rate for the SoftwareSerial port
mySerial.begin(baudrate);//9600);
Serial.print("Serial test - Serial 1 at baudrate ");
Serial.println(baudrate);
//while(1) mySerial.write('X'); // send continuous test
}
void loop() {
if (mySerial.available())
Serial.write(mySerial.read());
while (Serial.available())
mySerial.write(Serial.read());
}
works OK to an arduino Due - I would still tend to reduce the baudrate to say 38400
Note: loopback - connecting D5 to D6 does not work