フィルターのクリア

Possible to check if ThingSpeak is ready to receive data?

6 ビュー (過去 30 日間)
BRIAN MINOR
BRIAN MINOR 2020 年 11 月 8 日
編集済み: BRIAN MINOR 2020 年 11 月 11 日
I'm thinking about adding a second channel, but I'd like both to receive data as often as I'm allowed to send it. I'm worried that if I program both devices to send data every 15 seconds, only one channel will receive data while the other will keep trying while the site is unavailable. I'm wondering if there's a way to check whether or not ThingSpeak is ready to receive data so that I can program my timers to start after receiving that confirmation. Thanks!
  2 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 11 月 8 日
Why will the site be unavailable? Have you tried sending data to both channels?
BRIAN MINOR
BRIAN MINOR 2020 年 11 月 8 日
I had a while back, but it was while I was still learning and experimenting with that process. I may not have had one of the units programmed correctly. I know I'm only able to send data every 15 seconds. The way the data was received, I assumed that limit was across all channels, not 15 seconds per channel.

サインインしてコメントする。

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 11 月 8 日
According to the answer here: https://community.thingspeak.com/forum/thingspeak-api/rate-limit-on-read-operations/ the limit is imposed per channel for free accounts.
  5 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 11 月 11 日
If you are using webread(), then you can check from the response. If it is '0', then the data was not written to the channel.
BRIAN MINOR
BRIAN MINOR 2020 年 11 月 11 日
編集済み: BRIAN MINOR 2020 年 11 月 11 日
Thanks! Before your response I found this. Would your example give the same range of responses? I'm printing the response to Serial and it prints within milliseconds of sending the data to ThingSpeak when it posts correctly. Every few instances when I send the data I get a response of -301 and when that happens there is a 10 second delay between sending the data and printing to Serial.
Here's the important part from the link:
int writeTDData(long TSChannel,unsigned int TSField1,float data1,unsigned int TSField2,data2,char* ReadAPIKey){
ThingSpeak.setField(TSField1,data1);
ThingSpeak.setField(TSField1,data2);
writeSuccess = ThingSpeak.writeFields(TSChannel, writeAPIKey);
return writeSuccess
Edit: I should be clear that when I get the -301 error the data wasn't posting. I've added a while loop that resends the data when encountering this. So far it always sends immediately on the second attempt. I see I would get a -401 response if I try sending data faster than every 15 seconds and the response is 200 when data posts correctly.

サインインしてコメントする。

コミュニティ

その他の回答  ThingSpeak コミュニティ

カテゴリ

Help Center および File ExchangeWrite Data to Channel についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by