//sesuaikan dengan Token pada akun masing-masing
#define BLYNK_TEMPLATE_ID "TMPL60JbkoIvf"
#define BLYNK_TEMPLATE_NAME "DHT22"
#define BLYNK_AUTH_TOKEN "xjWnUgX-grAdwjfRCWv3f4yKGqr7wcRF"

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

#include <DHT.h>  

#define BLYNK_PRINT Serial

const int DHT_PIN = 15;

DHT dht(DHT_PIN, DHT22);

char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Wokwi-GUEST"; 
char pass[] = ""; 

float temperature ;
float  humidity;

void setup(){
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);  
}

void loop(){
  temperature  = dht.readTemperature();
  humidity     = dht.readHumidity();

  Serial.println("Temp: " + String(temperature, 2) + "°C");
  Serial.println("Humidity: " + String(humidity, 1) + "%");
  Serial.println("---");
  delay(1000); 
  
  Blynk.virtualWrite(V0, temperature);  

  Blynk.run(); 
}