ESP32 and DHT22 HTTP Device
Posted: 24 Dec 2017 14:31
Dear all,
I have a question about HTTP Devices.
I built with a ESP32 and DHT22 sensor a easy ans cheap humidity and temperature sensor.
It is also possible that ESP sent the data to IP address with GET / POST.
I also can see the data in the browser on the IP address. Here is my code for the ESP.
At the moment I have problems to configure the HTTP Device. I'm really not a expert in programming HTTP /Java script...
Hope you can help me...
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close"); // the connection will be closed after completion of the response
client.println();
client.println("<!DOCTYPE HTML><html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">");
client.println("<meta http-equiv=\"refresh\" content=\"30\"></head>");
client.println("<body><div style=\"font-size: 3.5rem;\"><p>ESP32 - DHT</p><p>");
if(atoi(celsiusTemp)>=25){
client.println("<div style=\"color: #930000;\">");
}
else if(atoi(celsiusTemp)<25 && atoi(celsiusTemp)>=5){
client.println("<div style=\"color: #006601;\">");
}
else if(atoi(celsiusTemp)<5){
client.println("<div style=\"color: #009191;\">");
}
Br, Ruffy
I have a question about HTTP Devices.
I built with a ESP32 and DHT22 sensor a easy ans cheap humidity and temperature sensor.
It is also possible that ESP sent the data to IP address with GET / POST.
I also can see the data in the browser on the IP address. Here is my code for the ESP.
At the moment I have problems to configure the HTTP Device. I'm really not a expert in programming HTTP /Java script...
Hope you can help me...
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close"); // the connection will be closed after completion of the response
client.println();
client.println("<!DOCTYPE HTML><html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">");
client.println("<meta http-equiv=\"refresh\" content=\"30\"></head>");
client.println("<body><div style=\"font-size: 3.5rem;\"><p>ESP32 - DHT</p><p>");
if(atoi(celsiusTemp)>=25){
client.println("<div style=\"color: #930000;\">");
}
else if(atoi(celsiusTemp)<25 && atoi(celsiusTemp)>=5){
client.println("<div style=\"color: #006601;\">");
}
else if(atoi(celsiusTemp)<5){
client.println("<div style=\"color: #009191;\">");
}
Br, Ruffy