#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include"DHT.h"
#define Dht_pin 4
#define dht_type DHT22
#define LED 2
int buzzer = 18;
DHT dht(Dht_pin,dht_type);
long duration;
int distance;
// You should get Auth Token in the Blynk App.
char auth[] = "TMPL3p-AwyqVP";
char ssid[] = "Wokwi-GUEST"; // your ssid
char pass[] = ""; // your wifi pass
BlynkTimer timer;
void setup() {
pinMode(buzzer, OUTPUT);
// put your setup code here, to run once:
Serial.begin(115200);
dht.begin();
pinMode(LED, OUTPUT);
// Sets the echoPin as an Inpu
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
void loop() {
Blynk.run();
timer.run();
// put your main code here, to run repeatedly:
float humidity= dht.readHumidity();
float temp= dht.readTemperature();
if(humidity<10.0){
digitalWrite(LED, HIGH);
}
else{
digitalWrite(LED, LOW);
}
Serial.println("Temperature Value= ");
Serial.println(temp);
Serial.println("Humidity= ");
Serial.println(humidity );
delay(10); // this speeds up the simulation
Blynk.virtualWrite(V0, distance);
delay(1000);
}