#define BLYNK_TEMPLATE_ID "TMPL6d2LrvgbC"
#define BLYNK_TEMPLATE_NAME "latihan  login blynk"
#define BLYNK_AUTH_TOKEN "X8lHCgxxC4VePcOkC9rnZ4sHGvIjtG11"

#include <WiFi.h>  
#include <WiFiClient.h>    
#include <BlynkSimpleEsp32.h>
#include <DHT.h>
#define DHTPIN 5  //MENTION THE DIGITAL PIN WHERE YOU CONNECTED
#define  DHTTYPE DHT22 //DHT 11
DHT dht (DHTPIN, DHTTYPE);
char auth[]= BLYNK_AUTH_TOKEN;
char ssid[]="Wokwi-GUEST"; //nama hotspot yang digunakan
char pass []="" ;//password hotspot yang digunakan
BlynkTimer timer;

void setup(){
  Serial.begin(115200);
  Serial.println("Sistem Monitoring Suhu");
  dht.begin();
  Blynk.begin(auth,ssid,pass);
}
  
  void loop () {
    float h =dht.readHumidity(); //membaca kelembaban
    float t = dht.readTemperature(); //membaca suhu
    delay(1000);
  
    Blynk.virtualWrite(V1,h);//mengirim data humidity ke blynk
    Blynk.virtualWrite(V0,t); //mengirim data suhu ke blynk

    //menampilkan data padaserial monitor
    Serial.println("Temperature : ");;
    Serial.print(t);
    Serial.println(" Humidity :");;
    Serial.print(h);
  }