How to send AT commands to ESP8266 from the module Arduino
Posted: Fri Feb 19, 2016 11:13 am
Hello boys. I need to sent some AT command to ESP8266 from the module Arduino "https://github.com/esp8266/arduino", for example
AT+CIPSTART="TCP","x",80\r\n
AT+CIPSEND=x\r\n
GET ....
In many examples i see that some people use "Serial", but I don't know how use it. Could you help me. Please
This is my code
#include <ESP8266WiFi.h>
const char* ssid = "";
const char* pass = "";
WiFiClient client;
void setup() {
//start conection
Serial.begin(115200);
Serial.println("Conecting to: ");
Serial.println(ssid);
WiFi.begin(ssid, pass);
while(WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("Conecting to WiFi Net");
Serial.print("The IP is");
Serial.println(WiFi.localIP());
}
void loop() {
if (client.connect("thingspeak.com", 80) > 0)
{
//create start command
String startcommand = "AT+CIPSTART=\"TCP\",\"thingspeak.com\",80";
Serial.println(startcommand);
//create request command
String sendcommand = "GET http://api.thingspeak.com/apps/thinghtt ... U25MX5O06Y HTTP/1.0\r\n\r\n\r\n";//works for most cases
Serial.println(sendcommand);
//send
Serial.print("AT+CIPSEND=");
Serial.println(sendcommand.length());
delay(1000);
}
else {
Serial.println("Connection Error");
}
}
I want to get this
<html><body>
<span class="about-stat"><b>49,830</b> subscribers</span>
<span class="about-stat"> • <b>6,560,832</b> views</span>
<br>
<span class="about-stat">Joined May 14, 2009</span>
</body></html>
and this is what brings me back
AT+CIPSEND=97
AT+CIPSTART="TCP","thingspeak.com",80
GET http://api.thingspeak.com/apps/thinghtt ... U25MX5O06Y HTTP/1.0
AT+CIPSTART="TCP","x",80\r\n
AT+CIPSEND=x\r\n
GET ....
In many examples i see that some people use "Serial", but I don't know how use it. Could you help me. Please
This is my code
#include <ESP8266WiFi.h>
const char* ssid = "";
const char* pass = "";
WiFiClient client;
void setup() {
//start conection
Serial.begin(115200);
Serial.println("Conecting to: ");
Serial.println(ssid);
WiFi.begin(ssid, pass);
while(WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("Conecting to WiFi Net");
Serial.print("The IP is");
Serial.println(WiFi.localIP());
}
void loop() {
if (client.connect("thingspeak.com", 80) > 0)
{
//create start command
String startcommand = "AT+CIPSTART=\"TCP\",\"thingspeak.com\",80";
Serial.println(startcommand);
//create request command
String sendcommand = "GET http://api.thingspeak.com/apps/thinghtt ... U25MX5O06Y HTTP/1.0\r\n\r\n\r\n";//works for most cases
Serial.println(sendcommand);
//send
Serial.print("AT+CIPSEND=");
Serial.println(sendcommand.length());
delay(1000);
}
else {
Serial.println("Connection Error");
}
}
I want to get this
<html><body>
<span class="about-stat"><b>49,830</b> subscribers</span>
<span class="about-stat"> • <b>6,560,832</b> views</span>
<br>
<span class="about-stat">Joined May 14, 2009</span>
</body></html>
and this is what brings me back
AT+CIPSEND=97
AT+CIPSTART="TCP","thingspeak.com",80
GET http://api.thingspeak.com/apps/thinghtt ... U25MX5O06Y HTTP/1.0