I have a working SoftwareSerial connection to my ESP8266 module on my Arduino UNO board. However, the response I get from the ESP8266 using the SoftwareSerial library is semi-gibberish.
So I do get the correct response, but some characters are changed. For example when I ask the IP of the module, it sometimes returns the right IP, but most of the times just alters the IP, for example 092.168/123.5.
So what am I doing wrong?
This is the code I'm currently using:
#include <SoftwareSerial.h>
SoftwareSerial esp8266(10, 11);
void setup() {
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Started");
}
void loop() {
if (esp8266.available()) {
Serial.println(esp8266.readStringUntil("\n"));
}
if (Serial.available()) {
esp8266.write(Serial.read());
}
}
When I send the AT
command, I sometimes get OK□
or some other extra random characters.
So how do I make the SoftwareSerial show (or receive) the correct response?
begin
on software serial. – gre_gor Apr 21 '17 at 1:53