A wiring diagram would be helpful.
There are a few things that jump out at me immediately.
-
You should remove
check();
from your void loop, and use a BlynkTimer to call this function instead.
Read this:
https://docs.blynk.io/en/legacy-platform/legacy-articles/keep-your-void-loop-clean -
The 150 second delay in
closewindow
and the 130 second delay inopenwindow
will cause Blynk disconnections. You should use non-blocking BlynkTimers in Timeout mode instead. Read this:
Using BlynkTimer or SimpleTimer -
This makes no sense:
void wifi_publish(){ //Every value is sent twice, once for the Display and once for the Value graph.
Blynk.virtualWrite(V0, temp); //send Temperature
Blynk.virtualWrite(V1, temp); //send Temperature
Blynk.virtualWrite(V2, hum); //send Humidity
Blynk.virtualWrite(V3, hum); //send Humidity
Blynk.virtualWrite(V4, pres); //send Pressure
Blynk.virtualWrite(V5, pres); //send Pressure
Blynk.virtualWrite(V6, v); //send windspeed
Blynk.virtualWrite(V7, v); //send windspeed
Blynk.virtualWrite(V8, b); //send brightness
Blynk.virtualWrite(V9, b); //send brightness
Blynk.virtualWrite(V10, r); //send rain
Blynk.virtualWrite(V11, r); //send rain
}
You should be connecting the display widgets and the Superchart datastreams to the same virtual pin.
//Get values from server======================================
BLYNK_WRITE(V12){
v_set = param.asInt();
}
BLYNK_WRITE(V13){
temp_set = param.asInt();
}
BLYNK_WRITE(V14){
hum_set = param.asInt();
}
BLYNK_WRITE(V15){
b_set = param.asInt();
}
This code ONLY gets the values from the Blynk server when these values change. You need to add…
BLYNK_CONNECTED()
{
Blynk,syncVirtual(V12);
Blynk,syncVirtual(V13);
Blynk,syncVirtual(V14);
Blynk,syncVirtual(V15);
}
in order to force the Blynk server to send these values when the device connects or re-connects to the server.
Without this callback function in place, the sketch will use the hardcoded values for the v_set, temp_set, hum_set and b_set variables.
Pete.