Arduino IoTクラウド — SunFounder Elite Explorer Kit ドキュメント に成功
(ウィンドウズ11にて成功、リナックスでもいけた!
Wifi設定は一回やっとけば、thingsを作り直しても自動オンラインになった
Wifi設定は多分クラウド上に保管されている。。。。? すこし違うみたい?)
ThingsにDeviceを紐づける!シークレットキーはいらんかった
Wifi設定にすすむ ssidを選択して、パスワードをいれる
ここでR4 Wifiがオンラインになってないと以下が成功しない
次にクラウド変数を設定をして、スケッチにすすむ
DHTセンサーライブラリを検索し、チェック
あとは->をクリックしてマイコンにアップロードする
go to iot cloudが出てこんので、metadataをクリックしたらメニューボタンがでた!
ダッシュボードをつくりクラウド変数をvalude widgetに紐づける これで完成した
オンラインのままなら、ほかのpcからもダッシュボードが見れるはず(他日を期す)
注:Raspberry Pi Pico WのBlynkと動作概念は同一だった
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
https://qiita.com/macole/items/ba3fcbcc5945423984ac 上はセンサ表示、ここは操作
コピペする場合は+を除いてください。ledはクラウド変数!
sketch
/*
Sketch generated by the Arduino IoT Cloud Thing "Cloud Blink"
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
bool led;
Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/
#include "thingProperties.h"
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
+ pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
ArduinoCloud.update();
+ digitalWrite(LED_BUILTIN, led);
}
/*
Since Led is READ_WRITE variable, onLedChange() is
executed every time a new value is received from IoT Cloud.
*/
void onLedChange() {
+ Serial.print("Led status changed:");
+ Serial.println(led);
}
0 件のコメント:
コメントを投稿