Is there any reason an Arduino Primo cannot send data to my ThingSpeak field?
2 ビュー (過去 30 日間)
古いコメントを表示
Does the device need to have a secure protocol? The Primo does not.
7 件のコメント
Christopher Stapels
2020 年 3 月 17 日
in the http request function, add some delay after the post is sent. 200 ms should do, but I suggest you start with 500 and work down.
// POST data to ThingSpeak.
if (client.connect(server, 80)) {
client.println("POST /update HTTP/1.1");
client.println("Host: api.thingspeak.com");
client.println("Connection: close");
client.println("User-Agent: Primo");
client.println("X-THINGSPEAKAPIKEY: "+writeAPIKey);
client.println("Content-Type: application/x-www-form-urlencoded");
client.print("Content-Length: ");
client.print(data.length());
client.print("\n\n");
client.print(data);
% ADD DELAY HERE
delay(500);
Serial.println("RSSI = " + String(field1Data));
lastConnectionTime = millis();
}
}
client.stop();
採用された回答
Dale Lamb
2020 年 3 月 18 日
編集済み: Dale Lamb
2020 年 3 月 19 日
1 件のコメント
Christopher Stapels
2020 年 3 月 18 日
The bad example was my fault, so the least I can do is to see you through it. Thanks for letting me know it worked! I would still reccomend a bit more than 80 just to be safe. Unless you are really power strapped, 200 ms shouldnt hurt. The best thing to do is to actually poll for a response from the server, then you dont have to wait an arbitrary time. The ThingSpeak library does this, but I am sorry it wont compile for you. I read that you can also add a version of the dtostr function in the code yourself if you wish. Anyway, happy thingpseaking!
その他の回答 (0 件)
コミュニティ
その他の回答 ThingSpeak コミュニティ
参考
カテゴリ
Help Center および File Exchange で Read Data from Channel についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!