ESP8266 Tempature + 2 Line LCD Code + Restful Web Server
Posted on Thu, Apr 23, 2020 at 9:10 PM With 51 Views



#include
#include
#include
#include
#include "DHT.h"

#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);

const int refresh=3;
float tValue;//
float hValue;//
float fValue;//

#ifndef STASSID
#define STASSID "BramerNet"
#define STAPSK "nointernet4u"
#endif

const char* ssid = STASSID;
const char* password = STAPSK;

ESP8266WebServer server(80);
LiquidCrystal_I2C lcd(0x3F, 16, 2);

void sendTemp() {

String page = "";
page += String(tValue, 2);
page +="|";
page += String(hValue, 2);
page +="|";
page += String(fValue, 2);
page +="|";
page += WiFi.macAddress();
server.send(200, "text/html",page);
}

void handleNotFound() {

String message = "File Not Found";
message += "URI: ";
message += server.uri();
message += "Method: ";
message += (server.method() == HTTP_GET) ? "GET" : "POST";
message += "Arguments: ";
message += server.args();
message += "";
for (uint8_t i = 0; i