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)
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 (likeAT
) and then wait for a reply before sending anything else. – Majenko May 10 at 13:03#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