I want to send temperature data from an esp8266. I've adapted my code from this Instructable; this is my code:
#include "SoftwareSerial.h"
#include "ESP8266.h"
String ssid = "Red Wi-Fi de Alexis" ;
String password = "adrian2003" ;
SoftwareSerial wifi(4, 2) ;
String Host = "mail.interseccion.com.mx:8901" ;
String Url = "/Ws_Temperatura" ;
void setup()
{
wifi.begin(9600) ;
Serial.begin(9600) ;
wifi.println("AT+RST") ;
wifi.println("AT+CWJAP=\"" + ssid + "\",\"" + password + "\"") ;
}
void loop()
{
float tmp = 22.22 ;
//URL Temperatura
//URL: mail.interseccion.com.mx:8901/Ws_Temperatura?Id_temp=0&Id_Device=1&Valor=00.00&Temperatura_Action=Insert
String urluno = String("Id_temp=0&Id_Device=2&Valor=");
String temp = String(tmp);
String urldos = String("&Temperatura_Action=Insert");
String urlfinal = String(String(urluno) + String(tmp) + String(urldos));
int tamano = urlfinal.length() ;
wifi.println("AT+CIPSTART=\"TCP\",\"" + Host + "\", 8901") ;
String Post = "POST" + Url + "HTTP/1.1\r\n" +
"Host: " + Host + "\r\n" +
"Content-Type: application/x-www-form-urlencoded" +
"Content-Length: " + tamano + "\r\n" + urlfinal ;
wifi.println("AT+CIPSEND= " + Post.length()) ;
wifi.println("AT+CIPCLOSE") ;
}
I tried to send with esp8266 library but it doesn't work.