Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am new to Arduino pro mini (5 V running it at 3.3 V) and esp8266.

I am trying to use AT commands using sketch program.

Here is reported the code I tried:

#include <SoftwareSerial.h>
SoftwareSerial esp8266(2,3);

void setup()
{
  Serial.begin(9600);
  esp8266.begin(9600); // your esp's baud rate might be different
}

void loop()
{
 esp8266.println("AT");
 if(esp8266.available()) // check if the esp is sending a message 
 {
 while(esp8266.available())
  {
    Serial.println(esp8266.available());
    // The esp has data so display its output to the serial window 
    char c = esp8266.read(); // read the next character.
    delay(10);
    Serial.write(c);
  }  
 }
}

It is returning garbage value as well as when i checked the value of esp8266.available() it is always giving me 63 WHY?

The blue light glows when the instruction is sent to the esp, I am also not getting the OK output as I was getting with the Serial Monitor.

I have been on this for two days and still getting the same issue, any help it's appreciated.

ESP8266 connections
vcc ~ 3.5v (battery positive)
ch_pd ~ 3.5v (battery positive)
rx 3rd GPIO
tx 2ND GPIO
GND (battery negative)
share|improve this question
    
At the very least you are flooding the ESP8266 with AT\r\nAT\r\nAT\r\nAT\r\n... and it's not going to be too happy with that. You should send a command (like AT) and then wait for a reply before sending anything else. – Majenko May 10 at 13:03
    
delay(300) ? or how much – Deepankar Agrawal May 10 at 13:07
    
However long it takes for a reply to come back from the ESP8266. You need to be reading and interpreting what comes back, not just delaying blindly. – Majenko May 10 at 13:08
    
@Majenko thanks for the delay help was able to solve it #include<stdlib.h> #include <SoftwareSerial.h> SoftwareSerial monitor(2, 3); // RX, TX void setup() { monitor.begin(9600); Serial.begin(9600); sendDebug("AT+CIPSTART='TCP'"); delay(5000); Serial.println("Hello"); if(monitor.find("OK")){ Serial.println("RECEIVED: OK"); //connectWiFi(); } else{ Serial.println("RECEIVED: None"); } } void loop(){ } void sendDebug(String cmd){ monitor.println(cmd); Serial.println("Command: "+cmd); } – Deepankar Agrawal May 10 at 16:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.