Hi, Is there a problem in server blink I have a problem with the delay of the response of the server with my projects, although the speed of my Internet is very high
More details required.
Pete.
1 Like
Thank you, Mr. Pete.
When I turn on relay or turn it off, I wait about three or four seconds for the command to be executed. I don’t know exactly where the problem is.
Local or Cloud server?
Code?
Phone connected to Wi-Fi or GSM?
Android or iOS app?
Pete.
1 Like
Server cloud connection wifi android phone
/*
********************************************
14CORE ULTRASONIC DISTANCE SENSOR CODE TEST
********************************************
*/
#define TRIGGER 3
#define ECHO 1
// NodeMCU Pin D1 > TRIGGER | Pin D2 > ECHO
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "pBneIGBVC5RMWZK3whN_tqqOBHXv5eY4";
char ssid[] = "ULTRA ARDUINO";
char pass[] = "qwerty123";
void setup() {
Serial.begin (9600);
Blynk.begin(auth, ssid, pass);
pinMode(TRIGGER, OUTPUT);
pinMode(ECHO, INPUT);
pinMode(BUILTIN_LED, OUTPUT);
pinMode(12,OUTPUT);
digitalWrite(12,LOW);
}
void loop() {
long duration, distance;
digitalWrite(TRIGGER, LOW);
delayMicroseconds(2);
digitalWrite(TRIGGER, HIGH);
delayMicroseconds(10);
digitalWrite(TRIGGER, LOW);
duration = pulseIn(ECHO, HIGH);
distance = (duration/2) / 29.1;
if (distance <= 150) {
Blynk.virtualWrite(V0, 255);
}
else {
Blynk.virtualWrite(V0, 0);
}
if (distance <= 100) {
Blynk.virtualWrite(V1, 255);
}
else {
Blynk.virtualWrite(V1, 0);
}
if (distance <= 80) {
Blynk.virtualWrite(V2, 255);
}
else {
Blynk.virtualWrite(V2, 0);
}
if (distance <= 40) {
Blynk.virtualWrite(V3, 255);
}
else {
Blynk.virtualWrite(V3, 0);
}
if (distance <= 20) {
Blynk.virtualWrite(V4, 255);
}
else {
Blynk.virtualWrite(V4, 0);
}
Serial.print(distance);
Serial.println("Centimeter:");
Blynk.virtualWrite(V5, distance);
delay(200);
Blynk.run();
}
Please edit your code to use the correct triple backtick characters at the beginning and end of your code.
Triple backticks look like this:
```
Pete.
1 Like
Read this:
Pete.
1 Like