I'm trying to operate the esp8266. When I connect RX+TX pins to pins 1+2 on the Arduino, everything works fine. but when I'm trying to use software serial all hell breaks loose and the recieved data is garbadeged (It seems like everything is ok but I can't read the output data... more interesting, the output is not consistent!
example:
#include <SoftwareSerial.h>
SoftwareSerial esp8266(11, 10); // RX, TX
void setup() {
// put your setup code here, to run once:
esp8266.begin(19200);
Serial.begin(115200 );
}
void loop() {
esp8266.write("AT\r\n");
String buffer;
Serial.print("SENDING AT...");
for(uint64_t time = millis();(time+1000) > millis();)
for(;esp8266.available();buffer+=(char)esp8266.read());
buffer.replace("\r\n"," ");
Serial.println("RESPONSE:" + buffer);
}
I've tried changing the SerialMonitor baud rate, the input pins, but results are all the same.
I've recently changed the MCU(uno) to a different and even a different esp module from a different supplier, I am still getting the same results! I can't be the first one to encounter such phenomena...