//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);
}
esp:VIN
esp:GND.2
esp:D13
esp:D12
esp:D14
esp:D27
esp:D26
esp:D25
esp:D33
esp:D32
esp:D35
esp:D34
esp:VN
esp:VP
esp:EN
esp:3V3
esp:GND.1
esp:D15
esp:D2
esp:D4
esp:RX2
esp:TX2
esp:D5
esp:D18
esp:D19
esp:D21
esp:RX0
esp:TX0
esp:D22
esp:D23
dht1:VCC
dht1:SDA
dht1:NC
dht1:GND