Question: Would anyone know what I am doing wrong with this arduino code using Webmos D1 and the application Blynk? #include #include char auth[] = 2c1f0e13795b470e887461e169b29b7d;

Would anyone know what I am doing wrong with this arduino code using Webmos D1 and the application Blynk? #include #include

char auth[] = "2c1f0e13795b470e887461e169b29b7d"; //Blynk token char ssid[] = "DKJA-GUEST"; //Your WiFI SSID char pass[] = "shabbatshalom"; //Your Wifi password

// Define pin numbers const int echoPin = D6; const int trigPin = D7;

// Define variables long duration; int distance; int saveDis = 0;

SimpleTimer timer;

void sensorRead() { // Clears the trigPin 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); // Reads the echoPin, returns the sound wave travel time in microseconds saveDis = distance; // Save the distance to compare with the next value (for Blynk notification) distance = duration * 0.034 / 2; // Calculating the distance

Serial.println("Distance: " + String(distance) + "cm"); // Prints the distance on the Serial Monitor // Set Blynk notification for given range (in this case between 1-49cm) if (0 < distance && distance < 5) { Blynk.notify("Garage: Distance changed from " + String(saveDis) + "cm to " + String(distance) + "cm!"); } } void setup() { Blynk.begin(auth, ssid, pass); Blynk.notify("Check to see if your child is near your dishwasher detergent: " + String(ssid)); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); Serial.begin(115200); Serial.println("Motion Detector initializing..."); timer.setInterval(1000L, sensorRead); }

void loop() { Blynk.run(); timer.run(); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!