I’m using a Wemos d1 mini with a dht22 for my project.
I’ve checked the manual, but I’m still lost when it comes to have both a reading widget and an history graph fed at the same time. Maybe someone could point me in the right direction
Right now, I’m doing something like this:
BLYNK_READ(0)
{
Blynk.virtualWrite(0, h);
}
the result being a working reading widget, but a history graph that doesn’t update when app is not on (and to avoid this I’m using virtualWrite, righ?). Im also making a sync somewhere:
I saw that you must have written this answer a million times and are slowly despairing inside…
However, according to the docs:
or you can use Blynk.virtualWrite on hardware side.
Now, how am I supposed to combine blynk.read and blynk.virtualwrite to have something like this https://drive.google.com/open?id=0B9MKoh0XGwyDMDVoaXVUS1c1eFk working?
I mean, if the app is open, I can easily read the values with labeled value display. And for long term monitoring I have the history graph, right?
Want more widgets to update? Just dupe the line and change the Vpin.
Blynk.virtualWrite(V5, millis() / 1000);
Blynk.virtualWrite(V6, analogRead(A0)); // analog sensor?
Blynk.virtualWrite(V7, dht.readTemp()); // dht (not a real function but could be)
Blynk.virtualWrite(V8, myCustomFunction());
you can change the timer on line 58
timer.setInterval(1000L, myTimerEvent);
1000L = 1000ms = 1 second. Dont go any faster than 1 seconds for this type of data. I sometimes push my hardware to every 100ms for some sensors but the aim of the game is to lower the over number of requests made.
So you could combine all of those 4 requests in to 1 or 2.
Thanks for your answer! That’s actually the example I used to start (why does everyone seem to assume people don’t read docs or use examples?). But probably I’ve been doing too much instead of keeping it simple.
Removed something like 10 lines of code, moved around things a little and it works nicely.
Sometimes you just cannot see the forest for the trees…