I need to read the last 30 recorded temperature data. Where do I get them from?
Best regards
Ángel Royo
From Chile
I need to read the last 30 recorded temperature data. Where do I get them from?
Best regards
Ángel Royo
From Chile
assuming you are talking about a temp sensor attached to some hardware device that is running your code…
The sensor most likely does not store a list of readings. You have to put them somewhere.
When you read the sensor (in some loop or from a timer event) you get the current value. Next time you read it it overwrite the previous value. If you want to keep the last 30, store them in an array and keep writing new values to successive elements of the array.
When you get to 30, you have to start overwriting the old values from the start again, so you have to keep a variable that tracks where the oldest or newest value is kept.
The suggested method is good. And for a Blynk relevant solution, it depends on the widget type receiving the data… if you use a SuperChart, then you can pull the data fro CSV export, Reports Widget, or just view it. Be aware of some possible averaging over time.
For just simple viewing, you could also use the Terminal, but it may or may not clear the data when opening the App.
I use both for simple storage.monitoring of such data as power levels of my workbench… which doubles as my Sleep Cycle counter since I turn off the monitors when sleeping and thus lowers the current consumption enough to track.