I made the following circuit and I am just trying to send some basic AT commands to the ESP
This is my code:
#define esp8266 Serial2
#define CH_PD 4
#define speed8266 115200 // This is the speed that worked with my ESP8266
#define DEBUG true
void setup() {
esp8266.begin(speed8266);
Serial.begin(speed8266);
reset8266();
}
void loop() {
//Serial.print("");
sendData("AT", 2000, DEBUG); //Connect network
delay(1000);
}
// Send AT commands to module
String sendData(String command, const int timeout, boolean debug)
{
String response = "";
esp8266.print(command);
long int time = millis();
while ( (time + timeout) > millis())
{
while (esp8266.available())
{
// The esp has data so display its output to the serial window
char c = esp8266.read(); // read the next character.
response += c;
}
}
if (debug)
{
Serial.print(response+"\r\n");
}
return response;
}
void reset8266 ()
{
pinMode(CH_PD, OUTPUT);
digitalWrite(CH_PD, LOW);
delay(300);
digitalWrite(CH_PD, HIGH);
}
This is the output from serial monitor:
Please help me I don't know what to do...
If I connect
ESP Tx-> Arduino TX0
ESP Rx-> Arduino RX0
Arduino Reset->GND
ESP CH_PD-> 3.3V
I can easily send commands over the Serial Monitor and it works properly