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());}