You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2
Original file line number
Diff line number
Diff line change
@@ -83,7 +83,9 @@ symbolic link created for AnalogInput <<===>> ..\..\..\..\..\built-in-examples\0
83
83
### Including Code Snippets
84
84
85
85
Code snippets can be included by using the triple backticks syntax e.g. ` ```arduino` followed by the code and three closing backticks. The following syntaxes are supported:
\* The Opta is scheduled to be released soon, along with documentation how to use it. Read more at the [Opta communications page](https://store.arduino.cc/pages/opta).
64
67
65
68
Connection via Wi-Fi is an easy alternative, and your credentials can safely be entered during the configuration of a project. This type of connection is most suitable for low-range projects, where you connect your board to the cloud via your home/work/school router.
66
69
@@ -96,6 +99,24 @@ The Arduino IoT Cloud supports a wide range of third party boards based on the E
96
99
97
100
***To learn more about ESP32/ESP8266 support and how to set it up, visit the [Connecting ESP32 & ESP8266 to Arduino Cloud IoT](/cloud/iot-cloud/tutorials/esp-32-cloud) guide.***
98
101
102
+
### Ethernet
103
+
104
+
The Arduino IoT Cloud supports connection via Ethernet on a number of devices. The options to connect via Ethernet are the following:
105
+
- Connect with the [Portenta H7](https://store.arduino.cc/products/portenta-h7) in combination with an Ethernet compatible carrier/shield (see below).
106
+
- Connect with the [Opta](https://docs.arduino.cc/hardware/opta).\*
107
+
108
+
\* The Opta is scheduled to be released soon, along with documentation how to use it. Read more at the [Opta communications page](https://store.arduino.cc/pages/opta).
109
+
110
+
To connect with the **Portenta H7** board, you will need one of the following shields/carriers:
To enable communication via Ethernet with the Portenta H7, while configuring your device, you need to select the "Ethernet" option. If your device is already configured as a Wi-Fi device, you need to remove it before configuring it to Ethernet communication.
115
+
116
+

117
+
118
+
***Please note that older hardware such as the [Ethernet Shield Rev2](https://store.arduino.cc/products/arduino-ethernet-shield-2) and [MKR ETH Shield](https://store.arduino.cc/products/arduino-mkr-eth-shield) are currently not supported by the Arduino IoT Cloud.***
119
+
99
120
## Support
100
121
101
122
If you have any problems with the Arduino IoT Cloud, you can browse through common troubleshooting issues and find information on different features in the **Arduino Help Center**. If you don’t find the answer you are looking for, we are always happy to help you with any question regarding our products!
Copy file name to clipboardExpand all lines: content/arduino-cloud/01.getting-started/02.technical-reference/iot-cloud-tech-ref.md
+78-18
Original file line number
Diff line number
Diff line change
@@ -131,6 +131,19 @@ This feature allows Arduino devices to communicate with each other by sharing va
131
131
Using this feature you can link variables of the same data type between **two or more cloud-enabled devices**, and Arduino IoT Cloud will automatically ensure any change to their value is propagated among all linked boards.
132
132
For example, one button could set three smart bulbs to the same color by just setting a variable on one device and reading it on the others. Or you could turn on a heater when temperature sensors in your room or outside in your weather station drop below a certain level.
133
133
134
+
### Local Time
135
+
136
+
To retrieve local time, use the `ArduinoCloud.getLocalTime()` method in your sketch. The value returned represents the current local time expressed as a Unix timestamp (i.e. seconds from the epoch), and it automatically takes your time zone settings and DST (Daylight Saving Time) into account. Time zone can be set in the Thing configuration page within the Arduino IoT Cloud platform.
137
+
138
+
The returned timestamp can be displayed in a dashboard using a `CloudTime` variable and the [Time Picker widget](/arduino-cloud/getting-started/technical-reference#time-picker), or can be parsed with a third-party library such as [Time](https://www.arduino.cc/reference/en/libraries/time/) in case you want to show it on a display.
139
+
140
+
```arduino
141
+
myTimeVariable = ArduinoCloud.getLocalTime()
142
+
```
143
+
144
+
***Note that when using a board equipped with a hardware Real-Time Clock (RTC) the [Arduino_IoTCloud](https://github.com/arduino-libraries/ArduinoIoTCloud) library will use it automatically, thus communicating with the RTC from within your sketch or other libraries is not recommended. You can use the `getLocalTime()` and `getInternalTime()` methods provided by Arduino_IoTCloud instead.
145
+
***
146
+
134
147
## Things
135
148
136
149
In order to use your devices in IoT Cloud, you need to associate a Thing to each of them. A Thing is an abstract concept which holds the configuration of the variables and other settings, as well as the history of the data collected for the variables.
@@ -153,7 +166,7 @@ The steps below can be used as guidance when **setting up a Thing**:
153
166
154
167
## Variables
155
168
156
-
***Visit the main article on [Cloud Variables](arduino-cloud/getting-started/cloud-variables) for a more detailed coverage.***
169
+
***Visit the main article on [Cloud Variables](/arduino-cloud/getting-started/cloud-variables) for a more detailed coverage.***
157
170
158
171
A thing can have one or more variables. A variable can be used for multiple purposes:
159
172
@@ -295,42 +308,89 @@ One or more **Things** can be added to a **Dashboard**, with all or some of thei
295
308
296
309

297
310
298
-
***You can read more about [Dashboards & Widgets]().***
311
+
***You can read more about [Dashboards & Widgets](/arduino-cloud/getting-started/dashboard-widgets).***
299
312
300
313
## Recommended Code Practices
301
314
302
-
### Avoid blocking commands within the loop()
315
+
This section highlights some important aspects of writing code with regard to the implementations in the [ArduinoIoTCloud](https://github.com/arduino-libraries/ArduinoIoTCloud).
316
+
317
+
### Watchdog Timer (WDT)
318
+
319
+
All IoT Cloud sketches use a **Watchdog Timer (WDT)** by default. The WDT can be used to automatically recover from hardware faults or unrecoverable software errors.
320
+
321
+
A WDT is essentially a countdown timer, whereas it starts counting from a set value, and upon reaching zero, it resets the board. To prevent it from reaching zero, we continuously call it from the `loop()`, using the `ArduinoCloud.update()` function.
322
+
323
+
This is why, it is very important to not use any long blocking code in your sketch. For example, using a long `delay()` inside the `loop()` is **strongly discouraged**, as the WDT can reach zero and reset the board.
324
+
325
+
The WDT can however be disabled inside of the `setup()` function, by adding the `false` parameter:
***You can view the source code of this implementation [here](https://github.com/arduino-libraries/ArduinoIoTCloud/tree/master/src/utility/watchdog).***
332
+
333
+
### Alternatives to Delays
303
334
304
335
The `loop()` function includes the `ArduinoCloud.update();` call, which sends data to the cloud and receives updates. In order to get the best responsiveness in your cloud-connected projects, the `loop()` function should run as fast as possible. This means that no blocking commands should be used inside, and you should prefer a non-blocking programming approach whenever possible.
305
336
306
337
A common **blocking pattern** is the use of the `delay()` function which stops the execution of the function for the given time. We strongly advise to **get rid of this function** and achieve the same behavior in a non-blocking way with the `millis()` function as described below.
307
338
308
339
Let's see how to blink a LED. The traditional way involves the `delay()` function:
309
340
310
-
void loop() {
311
-
ArduinoCloud.update();
312
-
313
-
digitalWrite(LED_BUILTIN, HIGH);
314
-
delay(1000);
315
-
digitalWrite(LED_BUILTIN, LOW);
316
-
delay(1000);
317
-
}
341
+
```arduino
342
+
void loop() {
343
+
ArduinoCloud.update();
344
+
345
+
digitalWrite(LED_BUILTIN, HIGH);
346
+
delay(1000);
347
+
digitalWrite(LED_BUILTIN, LOW);
348
+
delay(1000);
349
+
}
350
+
```
318
351
319
352
This works, but it will cause a delay of at least two seconds between one execution of `ArduinoCloud.update()` and the next one, thus causing bad performance of the cloud communication.
320
353
321
354
This can be rewritten in a non-blocking way as follows:
322
355
323
-
void loop() {
324
-
ArduinoCloud.update();
325
-
326
-
digitalWrite(LED_PIN, (millis() % 2000) < 1000);
327
-
}
356
+
```arduino
357
+
void loop() {
358
+
ArduinoCloud.update();
359
+
360
+
digitalWrite(LED_PIN, (millis() % 2000) < 1000);
361
+
}
362
+
```
328
363
329
364
How does this work? It gets the current execution time provided by `millis()` and divides it by 2 seconds. If the remainder is smaller than one second it will turn the LED on, and if it's greater it will turn the LED off.
330
365
331
366
For a more complex and commented example, you can have a look at the [BlinkWithoutDelay example](/built-in-examples/digital/BlinkWithoutDelay).
332
367
333
-
### Avoid waiting for Serial Monitor to initialize connection
368
+
### I2C Usage
369
+
370
+
Components connected via I²C (including the sensors onboard the [MKR IoT Carrier](https://store.arduino.cc/products/arduino-mkr-iot-carrier)) uses the same bus as the **ECCX08** cryptochip. As the crypto chip is an essential part of establishing a connection to the IoT Cloud (it contains the credentials), it is important that other I²C peripherals are initialized after the connection has been made.
371
+
372
+
For example, if you are initializing a library such as [Arduino_MKRENV](https://www.arduino.cc/reference/en/libraries/arduino_mkrenv), your `setup()` should be implemented as:
Serial.println("Failed to initialize MKR ENV shield!");
388
+
while (1);
389
+
}
390
+
```
391
+
392
+
393
+
### Avoid Blocking Serial Communication
334
394
335
395
`while(!Serial) {}` loops endlessly until the Serial Monitor is opened. This is a useful practice in cases where you want to see all debug output from the start of the sketch execution. However, when building IoT systems using **`while(!Serial){}` can hinder our project from running autonomously**, stopping the board from connecting to the network and IoT Cloud before manually opening the Serial Monitor. Therefore, it is recommended to consider removing the `while(!Serial){}` loop if it's not necessary.
336
396
@@ -345,7 +405,7 @@ We provide two Arduino Iot Cloud APIs:
345
405
346
406
The Arduino IoT Cloud REST API can be called just with any **HTTP Client**, or using one of these clients:
**2.** The second is the **Data API (MQTT)** which allows you to send/receive Variables' data. An example of this API's use is sending IoT Cloud Variables' updates to the browser. A full [documentation of the Arduino IoT Cloud Data API (MQTT)](https://www.npmjs.com/package/arduino-iot-js) is available for advanced users.
Copy file name to clipboardExpand all lines: content/arduino-cloud/01.getting-started/04.cloud-lora-getting-started/cloud-lora-getting-started_.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -270,7 +270,7 @@ You can visit the [Activate an Arduino Pro Gateway with IoT Cloud](https://suppo
270
270
### Migrate Existing Gateway
271
271
272
272
273
-
If you had a gateway setup prior to the [A2A to TTS migration](linktoblogpost.com ), you will need to complete the following steps to use the Pro Gateway.
273
+
If you had a gateway setup prior to the A2A to TTS migration, you will need to complete the following steps to use the Pro Gateway.
0 commit comments