Martino Bertagnoli in Discussions
上次活动时间: 2022-10-19

I receive and visualize data from my weather station. (This is my channel: https://thingspeak.com/channels/1700157). I want to know and show the date of last time it rained. How can i do it? The data are updated every 15 minutes. Show last time it rained Use a MATLAB analysis to read the channel every day (or however often you want to see the last time it rained). First read the last time it rained, perhaps you could store it in the matadata field for you channel (see thec channel info read API and write channel API). Then read the rainfall data from the channel and find out the last time it was positive. Then compare that to the data you read from the meta data field and rewrite if the new value is more recent. You can use the timecontrol app to run the code as often as you want to check. You can create a MATLAB visualization to show the data from the last time it reained in a figure window, perhaps using the test() command. I was going to suggest using the status field for you channel, but if you write to the status asynchronously compared to the weather data, it will create gaps in your other channel data. Thanks. I created a MATLAB analysis to read the field of the rain. It checks the value and it decides if write it in another field. In MATLAB visualization, It reads when the last value was written. I also created a Time Control to run the code. It works good. Excellent! I appreciate that you let us know you got it working. Just keep in mind if you write to another field in the same channel, the other fields get null entries. You could consider using another channel to record the rain data and then showing it on the weather channel using a custom visualization. Yes, I write in a field, that it hasn't other entries. I replaced the Time Control with a React, so the code runs every time I receive a new data from the weather station. weather station rain

关于 ThingSpeak

The community for students, researchers, and engineers looking to use MATLAB, Simulink, and ThingSpeak for Internet of Things applications. You can find the latest ThingSpeak news, tutorials to jump-start your next IoT project, and a forum to engage in a discussion on your latest cloud-based project. You can see answers to problems other users have solved and share how you solved a problem.