#define BLYNK_TEMPLATE_ID "TMPL6zTG4BTtu"
#define BLYNK_TEMPLATE_NAME "Wokwi Blynk"
#define BLYNK_AUTH_TOKEN "VPm_uaZv2izpd9tZ0sDIBfElSyfsn27o"
// #include <WiFi.h>
// #include <WiFiClient.h>
// #include <BlynkSimpleEsp32.h>
// //name of the router and password
// const char* ssid = "Wokwi-GUEST";
// const char* password = "";
// const int led =34;
// void setup() {
// // put your setup code here, to run once:
// Serial.begin(115200);
// pinMode(led, OUTPUT);
// WiFi.begin(ssid, password);
// Serial.println("Connecting to WiFi...");
// while(WiFi.status() != WL_CONNECTED){
// delay(500);
// Serial.print(".");
// }
// Serial.println("");
// Serial.println("WIFI Connected");
// Serial.print("IP Address:");
// Serial.println(WiFi.localIP());
// Blynk.begin(BLYNK_AUTH_TOKEN, ssid, password);
// }
// void loop() {
// // put your main code here, to run repeatedly:
// delay(10); // this speeds up the simulation
// }
// #include <WiFi.h>
// #include <WiFiClient.h>
// #include <BlynkSimpleEsp32.h>
// //Name of router and password
// const char* ssid="Wokwi-GUEST";
// const char* password="";
// const int led=34;
// const int trigPin = 19;
// const int echoPin = 18;
// #define SOUND_SPEED 0.034
// #define CM_TO_INCH 0.393701
// long duration;
// int distanceCm;
// int distanceInch;
// BlynkTimer timer;
// void setup() {
// // put your setup code here, to run once:
// Serial.begin(115200);
// pinMode(led, OUTPUT);
// pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
// pinMode(echoPin, INPUT);
// WiFi.begin(ssid,password);
// Serial.println("connecting to wifi.......");
// //conect divice wifi
// while (WiFi.status() != WL_CONNECTED){
// delay(500);
// Serial.print(".");
// }
// Serial.println("");
// Serial.println("connected");
// Serial.print("WiFi Address: ");
// Serial.println(WiFi.localIP());
// Blynk.begin(BLYNK_AUTH_TOKEN,ssid,password);
// timer.setInterval(1000L,DistanceData);
// }
// void DistanceData(){
// digitalWrite(trigPin, LOW);
// delayMicroseconds(2);
// // Sets the trigPin on HIGH state for 10 micro seconds
// digitalWrite(trigPin, HIGH);
// delayMicroseconds(10);
// digitalWrite(trigPin, LOW);
// duration = pulseIn(echoPin, HIGH);
// distanceCm = duration * SOUND_SPEED/2;
// distanceInch = distanceCm * CM_TO_INCH;
// Serial.print("Distance (cm): ");
// Serial.println(distanceCm);
// Serial.print("Distance (inch): ");
// Serial.println(distanceInch);
// delay(500);
// Blynk.virtualWrite(V1,distanceCm);
// }
// BLYNK_WRITE(V0){
// int status =param.asInt();
// digitalWrite(led, status);
// }
// void loop() {
// // Clears the trigPin
// Blynk.run();
// timer.run();
// }