//requires the following libraries : DHT sensor library, Blynk, WiFi, and ServoESP32
//-Tee
#define BLYNK_TEMPLATE_ID "TMPLOj3lK08d"
#define BLYNK_DEVICE_NAME "dht22barber"
#define BLYNK_AUTH_TOKEN "0sq73tgpOvy2r-Sb9za9K0VpOoehAXNx"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <DHT.h>
#include <Servo.h>
#define LED_PIN 4
#define DHT_PIN 25
#define DHTTYPE DHT22
Servo servo;
DHT dht(DHT_PIN,DHTTYPE);
int LED_Value = 0;
char auth[] = BLYNK_AUTH_TOKEN;
BLYNK_WRITE(V2)
{
LED_Value = param.asInt();
if (LED_Value == 1){
digitalWrite(LED_PIN,HIGH);
}
else{
digitalWrite(LED_PIN,LOW);
}
}
BLYNK_WRITE(V3)
{
servo.write(param.asInt());
}
void setup() {
servo.attach(13);
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
dht.begin();
pinMode(LED_PIN, OUTPUT);
Blynk.begin(auth, "Tupr_Student Super Wifi", "tuprschool");
delay(1000);
}
void loop() {
float t = dht.readTemperature();
float h = dht.readHumidity();
Blynk.run();
Blynk.virtualWrite(V0, t);
Blynk.virtualWrite(V1, h);
}