Here is a simple sketch that allows you to input cmds to the esp via an arduino serial console and view the response from the esp.
A few things to be aware of:
1. use a voltage divider circuit between the Arduino TX and the ESP RX. The arduino's signal is 5v , but the ESP expects 3.3v. This is important b/c using 5v can eventually damage the esp.
2. depending on the firmware in your esp you may have to change the baud rate in the sketch below before it will work.
3. be careful to get the tx,rx connections correct.
4. i use a 1000uF electrolytic capacitor across pwr & gnd of the esp in order to smooth out the voltage. The arduino may not be able to supply enough amps when the esp transmits and the cap will help with this.
5. and finally check out this site for a lot of good info:
http://www.electrodragon.com/w/ESP8266---------------------------------------------
#include <SoftwareSerial.h>
/* This sketch allows entering AT cmds to control
the esp8266-05
*/
// Arduino RX=10,TX=11 connected to TX,RX on esp8266-05
SoftwareSerial mySerial(10, 11);
void setup()
{
Serial.begin(9600);
Serial.println("starting esp8266 comm sketch");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
}
char cmd[32];
void loop()
{ int i=0;
if (mySerial.available()) // input from the esp8266
Serial.write(mySerial.read()); // write to host
while (Serial.available()) {
cmd[i]=Serial.read(); // buffer cmd
i++;
delay(5);
}
if( i ) { // if host sent us cmd
cmd[i]=0;
mySerial.println(cmd); // send to esp8266
}
}