arduino-libraries / ArduinoIoTCloud

https://app.arduino.cc
Other
109 stars 78 forks source link
arduino arduino-iot-cloud arduinocloud arduinoiot arduinoiotcloud cloud iot

ArduinoIoTCloud

Check Arduino status Compile Examples Spell Check Unit Tests codecov

What?

The ArduinoIoTCloud library is the central element of the firmware enabling certain Arduino boards to connect to the Arduino IoT Cloud. The following boards are supported:

How?

1) Register your Arduino IoT Cloud capable board via Arduino IoT Cloud (Devices Section). 2) Create a new logical representation known as a Thing.

Arduino IoT Cloud Components

How-to-use

void setup() { Serial.begin(9600); while(!Serial) { } pinMode(LED_BUILTIN, OUTPUT);

initProperties(); ArduinoCloud.begin(ArduinoIoTPreferredConnection); }

void loop() { ArduinoCloud.update(); seconds = millis() / 1000; }

void onLedChange() { digitalWrite(LED_BUILTIN, led); }


### FAQ
#### Watchdog
The [1.0.0](https://github.com/arduino-libraries/ArduinoIoTCloud/releases/tag/1.0.0) release of this library adds watchdog functionality to all ATSAMD21G18 based cloud connected boards. A watchdog is simply an electronic timer counting down from a preset start value which, upon reaching zero, triggers a reset of the microcontroller. It can be used to automatically recover from temporary hardware faults or unrecoverable software errors. In order to avoid the watchdog from reaching zero the countdown timer needs to be regularly re-set to its start value. This is happening within `ArduinoCloud.update()` which is periodically called at the start of the `loop()` function. Although the watchdog is automatically enabled it can be disabled by setting the second parameter of `ArduinoCloud.begin(...)` to `false`:
```C++
ArduinoCloud.begin(ArduinoIoTPreferredConnection, false).

Whatchdog is enabled by default using the following boards: MKR 1000, MKR WiFi 1010, MKR GSM 1400, MKR NB 1500, MKR WAN 1300/1310, Nano 33 IoT, Portenta H7, Nano RP2040 Connect, Nicla Vision, OPTA WiFi, OPTA RS485, OPTA Lite, GIGA R1 WiFi

Device can not subscribe to THING_ID

ArduinoIoTCloudTCP::handle_SubscribeMqttTopics could not subscribe to /a/t/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/e/i

In this case either the device has not been associated with the thing within the Arduino IoT Cloud GUI configuration or there's a typo in the thing ID.

OTA

OTA is supported by the following boards: MKR WiFi 1010, Nano 33 IoT, Portenta H7, Nano RP2040 Connect, Nicla Vision, OPTA WiFi, OPTA RS485, OPTA Lite, GIGA R1 WiFi, Nano ESP32, ESP32

Authentication

Boards can authenticate to the ArduinoIoTCloud servers using 3 methods: