Ii make datastream in Blynk Dashboard and refferes to V1 etc. But i just get random temperature readings in Blynk dashboard and the relay switch does not work at all. The temperature value in Blynk Dashboard changes when i reconnect the device.
I have connected my board to the app with success.
Are you looking at the Template view, or the Device view in the web dashboard?
The Template view is designed to show some random data “to help visualise the widgets”, but it confuses the hell out of most people, including me.
A side issue, this code is very badly written. You rake 4 temperature readings every second, rather than taking just one and saving it to a local temporary variable, and using that variable in your serial print, Blynk.virtualWrite and if comparisons…
That’s your problem, this is dummy random data. You need to be in Device view (the magnifying glass on the left hand side at the top)
I’m sure it does, but it’s still bad practice to take 4 different readings and do different things with them.
If the last one threw-out a -127 error value then you’d wonder why the if statement evaluated as false, yet the serial print data showed a reading that should make it evaluate as true.
Also, most sensors don’t like to be polled too frequently, and you’re polling this 4 times more often than you need to.
It’s not really about slowing-down the readings, its about taking one reading each time the function is called and using that reading for all the action you then take within that function.
Imagine that you were taking a time reading rather than a temperature reading. The time could change during the course of the execution of the function, so the values would be different at each point.
The same goes for the temperature readings, the sensor may not give the same result each time, so better to read it once at the start of the function the use that same reading elsewhere in the function.
I tried the code you postet and the temperature reacts now and is right, but i get an “0” sometimes between readings. I changed the temp interval to 2 seconds.
I have not anything that says “data invalidation” in advanced settings.
I have now changed to Blynk 1.0 library (Not beta) and deleted other Blynk librarys i had from library folder. No success.
This is the problem i have now:
It shows the right temperature, but i get an “0” from time to time between readings.
The relay does not work at all. But the LED that lights up when relay is on works fine. It’s just the relay. The relay is soldered to pin D8 on my Wemos D1 Mini. (Pin 15 in code)
PS! Nothing shows up in serial monitor when i turn relay on/off either.
So a non working relay and a temperature that shows “0” between readings is the two problems i have now.