Skip to main content
Arduino

Return to Revisions

3 of 3
Minor fixes and added erroneous output to answer
Greenonline
  • 3.2k
  • 7
  • 36
  • 48

Arduino outputs garbage values on serial monitor with ESP8266

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?

lang-cpp

AltStyle によって変換されたページ (->オリジナル) /