-->
Page 1 of 2

ESP8266 not responding to arduino sketch

PostPosted: Fri Nov 13, 2015 7:18 am
by Labspace
Hi,

I am using ESP8266 - 01 with default baud rate 115200 and Arduino UNO for my mini project. I interfaced ESP with Arduino and send AT commands via Serial monitor. The ESP responded properly. But when I send the AT commands from the Arduino sketch
Code: Select allSerial.println("AT");
the ESP is not responding. Please help if anyone know how to solve this issue.

Thanks

Re: ESP8266 not responding to arduino sketch

PostPosted: Fri Nov 13, 2015 2:34 pm
by martinayotte
Any AT commands should end with CR+LF, so you should send the command like :
Code: Select allSerial.println("AT\r\n");

Re: ESP8266 not responding to arduino sketch

PostPosted: Mon Nov 16, 2015 11:39 am
by Labspace
martinayotte wrote:Any AT commands should end with CR+LF, so you should send the command like :
Code: Select allSerial.println("AT\r\n");


I tested my ESP with the code shown below
Code: Select all#include <SoftwareSerial.h>

SoftwareSerial serial(2,3);
void setup()
{
 Serial.begin(115200);
 serial.begin(115200);

 serial.println("AT\r\n");
 Serial.println(serial.read());
}

void loop()
{

}


But I got a response " -1 ". The ESP still responds to the Serial monitor.

Thanks

Re: ESP8266 not responding to arduino sketch

PostPosted: Mon Nov 16, 2015 2:16 pm
by martinayotte
serial.read() function return only 1 character, not the whole string received, so you have to do a loop with serial.available() to figure out if some characters still in the buffer.