I have connected my Arduino with an ESP8266.
When I check the ESP8266, by manually entering commands at serial monitor, I get correct results.
However, when I run this program
#include<SoftwareSerial.h>
SoftwareSerial esp8266(2,3);
void setup() {
Serial.setTimeout(5000);
Serial.begin(115200);
esp8266.begin(115200);
delay(1000);
}
void loop() {
delay(2000);
String command="AT";
esp8266.println(command);
if(esp8266.available())
{
while(esp8266.available())
{
char c=esp8266.read();
Serial.write(c);
}
}
}
I get garbage values where sometimes it has an OK
in between the output:
" Received: "ÁT OK " Received: "AÔ ÏË " Received: "AÔ OK " Received: "ÁT ÏË " Received: "ÁT OË " Received: "ÁÔ OK " Received: "Á¬ OK " Received: "ÁT OË "
Could someone help me?
if(esp8266.available()) { Serial.print("Received: \""); while(esp8266.available()) { char c=esp8266.read(); Serial.write(c); } Serial.println("\""); }
and post back the output of the serial monitor – frarugi87 Nov 25 '15 at 16:26