#include "DHTesp.h"
#include <WiFi.h>

WiFiClient espClient;
char Humidity[10];
char Temp[10];
DHTesp dhtSensor;

//Setip ESP32 WIFI
void setup() {
  WiFi.mode(WIFI_STA);
  WiFi.begin("Wokwi-GUEST", "");

  Serial.begin(9600);
  dhtSensor.setup(15, DHTesp::DHT22); //setup DHT sensor
}


void loop() { 

// Get the temp and humidity
  TempAndHumidity data = dhtSensor.getTempAndHumidity();
  sprintf(Humidity, "%.2f", data.humidity);
  sprintf(Temp, "%.2fC", data.temperature);
  Serial.println("Humidity:");
  Serial.println(Humidity);
  Serial.println("Temperature:");
  Serial.println(Temp);

  delay(1000);
}