9:36 am

November 10, 2018

I need to determine max and min temperature in 24 hours. I use Example "Calculate high and low temperatures". When I want to write data to a channel, I have a problem. Calculation runs every 15 minutes using timecontrol. If the value is the same, then I get back errors.
Maximum Temperature for the past 24 hours is =
11.1000
Note: To write data to another channel, assign the write channel ID
andAPI Key to 'WriteChannelID' and 'writeAPIKey' variables. Also
uncomment the line of code containing 'thingSpeakWrite'
(remove '%' sign at the beginning of the line.) Error using Calculate high temperature MAX Garden (line 56)
The server returned the status 500 with the message "Internal Server Error" in response to the request to URL https://api.thingspeak.com....
Can you please advise me?
3:40 pm


Moderators
March 7, 2017

ThingSpeak requires unique timestamps. Since the code writes with the timestamp of the max or min, and you run it, it will repeatedly try to write the nonunique timestamp.
My suggestion is to write the present timestamp and then write the timestamp of interest to another field.
thingSpeakWrite(writeChannelID,[maxTempF string(timeMaxTemp)],'Writekey',writeAPIKey);
with this change, it will write the time of max temperature in field 2, and the timestamp for the entry will be exactly when the timeControl ran.
Does that help?
** Edited string function as suggested below (thanks) **
9:24 am

November 10, 2018

12:11 pm

December 2, 2018

10:00 am


Moderators
March 7, 2017

Hola,
You can use the charts API to make a graphic in your browser:
Puedes usar el charts API para hacer un gráfico en tu navegador:
https://www.mathworks.com/help/thingspeak/createchart.html
You can embed an iframe on a web page that you create:
Puede incrustar un iframe en una página web que cree:
https://www.mathworks.com/help/thingspeak/embed-your-thingspeak-plots-on-web-pages.html
https://www.mathworks.com/help/thingspeak/embed-a-chart.html
Most Users Ever Online: 166
Currently Online:
25 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
rw950431: 272
Vinod: 240
piajola: 95
turgo: 70
vespapierre: 63
Adarsh_Murthy: 62
Member Stats:
Guest Posters: 1
Members: 8665
Moderators: 1
Admins: 2
Forum Stats:
Groups: 3
Forums: 14
Topics: 1600
Posts: 5760
Newest Members:
estebanmateo93, mikewrite, onlinebusiness, winzy99, Zark_zeugan, StefanWiModerators: cstapels: 460
Administrators: Hans: 405, lee: 457