yo#include "DHTesp.h"
#include "WiFi.h"
#include "config.h"
char* ssid = "Wokwi-GUEST";
char* password = "";
#define LED_PIN 2
WiFiServer server(80);
//AdafruitIO_Feed *digital = io.feed("saida");
const int DHT_PIN = 15;
DHTesp dhtSensor;
void setup() {
Serial.begin(115200);
dhtSensor.setup(DHT_PIN, DHTesp::DHT22);
delay(10);
Serial.println();
Serial.println();
Serial.print("Conectando para a rede ");
Serial.print(ssid);
WiFi.begin(ssid,password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected.");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
Serial.println("MAC address: ");
Serial.println(WiFi.macAddress());
Serial.println("Sub Mask: ");
Serial.println(WiFi.subnetMask());
Serial.println("Gareway: ");
Serial.println(WiFi.gatewayIP());
Serial.println("DNS: ");
Serial.println(WiFi.dnsIP());
delay(10000);
server.begin();
}
void loop() {
//Verifica cliente conectado
WiFiClient client = server.available();
if (!client)
{
return;
}
//Aguarda cliente enviar dados
while (!client.available())
{
delay(1);
}
client.println("HTTP/1.1 200 ok");
client.println("Content-Type: text/html");
client.println("");
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("<h1>Fundação Bradesco</h1>");
client.println("<h2>IOT - STI - Profa. Eliana </h2>");
client.println("</html>");
// TempAndHumidity data = dhtSensor.getTempAndHumidity();
// Serial.println("Temp: " + String(data.temperature, 2) + "°C");
// Serial.println("Humidity: " + String(data.humidity, 1) + "%");
// Serial.println("---");
delay(1000);
}