#include <WiFi.h>
#include <DHT.h>

#define BLYNK_TEMPLATE_ID   "TMPL6uwtXcYAM"
#define BLYNK_TEMPLATE_NAME "Tugas1"
#include <BlynkSimpleEsp32.h>

#define DHTPIN  23
#define TEMP    V0
#define HUMI    V1

#define AUTH_TOKEN  "uyRyoMcRk10euXtiJ_mElURstydjpNro"
#define SSID        "Wokwi-GUEST"
#define PASS        ""

DHT dht(DHTPIN, DHT22);
BlynkTimer timer;

void setup() {
  dht.begin();

  Blynk.begin(AUTH_TOKEN, SSID, PASS);
  timer.setInterval(1000L, sendSensor);
}

void loop() {
  Blynk.run();
  timer.run();
}

void sendSensor() {
  float t = dht.readTemperature();
  float h = dht.readHumidity();

  Blynk.virtualWrite(TEMP, t);
  Blynk.virtualWrite(HUMI, h);
}