[SOLVED] BLYNK_WRITE Slow

Hello,
I am new to Blynk, but “fairly” experienced with the arduino platform. I am trying to control an incubator and control with the arduino but now do it remotely. I’ve started with a simpler thermostat controller just to gain experience with BLYNK.

Main Problem: BLYNK_WRITE response time is greater than 5 minutes sometime, but Blynk.virtualWrite is almost instant (temperature probe TMP36)

Below is my Arduino code. I would appreciate the help/input.

#include <BlynkSimpleSerial.h>
#include "DHT.h" 
#include <OneWire.h>
#define BLYNK_PRINT Serial // Enables Serial Monitor

int ONE_WIRE_BUS= 2;
float tempF;
float temph;
float humid;
boolean heat;
WidgetLED led1(6);
WidgetLED led2(7);
DHT dht;
char auth[] = "YourAuthToken"; 


void setup()
{
  dht.setup(4); // data pin 2
  pinMode(13, OUTPUT);
  pinMode(5, OUTPUT);
  Serial.begin(9600); // See the connection status in Serial Monitor
  Blynk.begin(auth);  // Here your Arduino connects to the Blynk Cloud.
}

BLYNK_WRITE(0){
  int x = param.asInt();
  if (x > temph){
    led2.on();
    digitalWrite(13,HIGH);}
  else{led2.off();
    digitalWrite(13,LOW);}
    Blynk.virtualWrite(5, x);}
  
void loop()
{
  
  led1.on();
  int reading = analogRead(0);
  float voltage = reading * 5.0;
  voltage /= 1024.0; 
  float tempF = ((voltage - 0.5) * 100 * 9.0 / 5.0) + 32.0;
  humiditychk();
  Blynk.virtualWrite(2, tempF);
  Blynk.virtualWrite(3, temph);
  Blynk.virtualWrite(4, humid);
  led1.off(); 
  Blynk.run(); }


void humiditychk(){
  delay(dht.getMinimumSamplingPeriod());
  humid= dht.getHumidity();
  temph=dht.toFahrenheit(dht.getTemperature());}

Please check pushdata.ino example and use timer for Virtual Writes. You are just making too many requests in the loop.

SOLVED. After running through some scenarios, I found the issue with the “slow” response from BLYNK_WRITE.
The problem did not stem from BLYNK_WRITE itself but rather a delay in one of the subs
delay(dht.getMinimumSamplingPeriod());
Everything works great now.

Word of advice, follow the advice from the Blynk guys and don’t use delays, and if you are having issues check any libraries you are using for delays.

A post was split to a new topic: Unwanted delay in slider reaction