Skip to content

Commit b3225d5

Browse files
authored
Merge branch 'marqdevx/linter/rules-updates' into marqdevx/linter/nxp
2 parents ac4e5c2 + 68f475a commit b3225d5

File tree

445 files changed

+154875
-9693
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

445 files changed

+154875
-9693
lines changed

.github/workflows/deploy-prd.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ jobs:
2222
cache: "npm"
2323
cache-dependency-path: "**/package-lock.json"
2424

25+
- name: Render Datasheets
26+
run: cd ${GITHUB_WORKSPACE}/scripts/datasheet-rendering;./render-datasheets.sh
27+
28+
- name: Copy Static Files
29+
run: |
30+
mkdir -p static/resources/datasheets static/resources/schematics static/resources/pinouts
31+
find ./content/hardware -type f -name "*-schematics.pdf" -exec cp {} ./static/resources/schematics/ \;
32+
find ./content/hardware -type f -name "*-datasheet.pdf" -exec cp {} ./static/resources/datasheets/ \;
33+
find ./content/hardware -type f -name "*-full-pinout.pdf" -exec cp {} ./static/resources/pinouts/ \;
34+
find ./content/hardware -type f -name "*-pinout.png" -exec cp {} ./static/resources/pinouts/ \;
35+
2536
- name: Gatsby main cache
2637
uses: actions/cache@v2
2738
id: gatsby-cache-folder
@@ -41,8 +52,7 @@ jobs:
4152
${{ runner.os }}-public-gatsby-
4253
4354
- run: npm install
44-
45-
- run: GENERATE_DATASHEETS=true npm run build
55+
- run: npm run build
4656

4757
- name: Configure AWS Credentials
4858
uses: aws-actions/configure-aws-credentials@v1

.github/workflows/deploy-stg.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ jobs:
2020
node-version: 14
2121
cache: "npm"
2222
cache-dependency-path: "**/package-lock.json"
23+
24+
- name: Render Datasheets
25+
run: cd ${GITHUB_WORKSPACE}/scripts/datasheet-rendering;./render-datasheets.sh
26+
27+
- name: Copy Static Files
28+
run: |
29+
mkdir -p static/resources/datasheets static/resources/schematics static/resources/pinouts
30+
find ./content/hardware -type f -name "*-schematics.pdf" -exec cp {} ./static/resources/schematics/ \;
31+
find ./content/hardware -type f -name "*-datasheet.pdf" -exec cp {} ./static/resources/datasheets/ \;
32+
find ./content/hardware -type f -name "*-full-pinout.pdf" -exec cp {} ./static/resources/pinouts/ \;
33+
find ./content/hardware -type f -name "*-pinout.png" -exec cp {} ./static/resources/pinouts/ \;
2334
2435
- name: Gatsby main cache
2536
uses: actions/cache@v2
@@ -40,8 +51,7 @@ jobs:
4051
${{ runner.os }}-public-gatsby-
4152
4253
- run: npm install
43-
44-
- run: GENERATE_DATASHEETS=true npm run build
54+
- run: npm run build
4555

4656
- name: Configure AWS Credentials
4757
uses: aws-actions/configure-aws-credentials@v1
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Render datasheets
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
render-datasheets:
8+
runs-on: ubuntu-latest
9+
env:
10+
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-node@v2
15+
with:
16+
node-version: 14
17+
cache: "npm"
18+
cache-dependency-path: "**/package-lock.json"
19+
20+
- name: Render
21+
run: |
22+
cd scripts/datasheet-rendering
23+
./render-datasheets.sh

.vscode/tasks.json

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"cwd": "${workspaceFolder}${pathSeparator}scripts${pathSeparator}validation"
8888
},
8989
"windows": {
90-
"command": "node .\\fix-issues.js -p ..\\..\\content\\hardware\\"
90+
"command": "node .\\fix-issues.js -p '..\\..\\content\\hardware\\'"
9191
},
9292
"group": "none",
9393
"presentation": {
@@ -97,14 +97,14 @@
9797
"problemMatcher": []
9898
},
9999
{
100-
"label": "Generate all datasheets",
100+
"label": "Render all datasheets",
101101
"type": "shell",
102-
"command": "./generate-datasheets.sh",
102+
"command": "./render-datasheets.sh",
103103
"options": {
104-
"cwd": "${workspaceFolder}${pathSeparator}scripts${pathSeparator}datasheet-generator"
104+
"cwd": "${workspaceFolder}${pathSeparator}scripts${pathSeparator}datasheet-rendering"
105105
},
106106
"windows": {
107-
"command": ".\\generate-datasheets.cmd"
107+
"command": ".\\render-datasheets.cmd"
108108
},
109109
"group": "none",
110110
"presentation": {
@@ -114,14 +114,14 @@
114114
"problemMatcher": []
115115
},
116116
{
117-
"label": "Generate datasheet (current document)",
117+
"label": "Render datasheet (current document)",
118118
"type": "shell",
119-
"command": "./generate-datasheets.sh '../../${relativeFileDirname}'",
119+
"command": "./render-datasheets.sh '../../${relativeFileDirname}'",
120120
"options": {
121-
"cwd": "${workspaceFolder}${pathSeparator}scripts${pathSeparator}datasheet-generator"
121+
"cwd": "${workspaceFolder}${pathSeparator}scripts${pathSeparator}datasheet-rendering"
122122
},
123123
"windows": {
124-
"command": ".\\generate-datasheets.cmd '..\\..\\${relativeFileDirname}'"
124+
"command": ".\\render-datasheets.cmd '..\\..\\${relativeFileDirname}'"
125125
},
126126
"group": "none",
127127
"presentation": {
@@ -138,7 +138,7 @@
138138
"cwd": "${workspaceFolder}"
139139
},
140140
"windows": {
141-
"command": ".\\scripts\\spell-check.cmd"
141+
"command": ".\\scripts\\spell-check.cmd"
142142
},
143143
"group": "none",
144144
"presentation": {
@@ -163,6 +163,9 @@
163163
"options": {
164164
"cwd": "${workspaceFolder}"
165165
},
166+
"windows": {
167+
"command": ".\\scripts\\spell-check-fix.cmd"
168+
},
166169
"group": "none",
167170
"presentation": {
168171
"reveal": "always",

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ symbolic link created for AnalogInput <<===>> ..\..\..\..\..\built-in-examples\0
8383
### Including Code Snippets
8484

8585
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:
86+
```
8687
arduino, bash, markup, clike, c, cpp, css, css-extras, javascript, jsx, js-extras, coffeescript, diff, git, go, graphql, handlebars, json, less, makefile, markdown, objectivec, ocaml, python, reason, sass, scss, sql, stylus, tsx, typescript, wasm, yaml
88+
```
8789

8890

8991
## Previewing Changes
Loading

content/arduino-cloud/01.getting-started/01.iot-cloud-getting-started/iot-cloud-getting-started.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ The following boards connect to the Arduino IoT Cloud via Wi-Fi.
5959
- [Nano 33 IoT](https://store.arduino.cc/arduino-nano-33-iot)
6060
- [Portenta H7](https://store.arduino.cc/portenta-h7)
6161
- [Portenta H7 Lite Connected](https://store.arduino.cc/products/portenta-h7-lite-connected)
62+
- [Portenta Machine Control](https://store.arduino.cc/products/arduino-portenta-machine-control)
6263
- [Nicla Vision](https://store.arduino.cc/products/nicla-vision)
64+
- [Opta](https://docs.arduino.cc/hardware/opta).\*
6365

66+
\* 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).
6467

6568
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.
6669

@@ -96,6 +99,24 @@ The Arduino IoT Cloud supports a wide range of third party boards based on the E
9699

97100
***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.***
98101

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:
111+
- [Portenta Vision Shield Ethernet](https://store.arduino.cc/products/arduino-portenta-vision-shield-ethernet)
112+
- [Portenta Machine Control](https://store.arduino.cc/portenta-machine-control)
113+
114+
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+
![Choose the Ethernet option.](assets/ethernet.png)
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+
99120
## Support
100121

101122
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!

content/arduino-cloud/01.getting-started/02.technical-reference/iot-cloud-tech-ref.md

Lines changed: 64 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -308,42 +308,89 @@ One or more **Things** can be added to a **Dashboard**, with all or some of thei
308308

309309
![Create widgets from a Thing](./images/create-widget-from-thing.png)
310310

311-
***You can read more about [Dashboards & Widgets]().***
311+
***You can read more about [Dashboards & Widgets](/arduino-cloud/getting-started/dashboard-widgets).***
312312

313313
## Recommended Code Practices
314314

315-
### 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:
326+
327+
```arduino
328+
ArduinoCloud.begin(ArduinoIoTPreferredConnection, false).
329+
```
330+
331+
***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
316334

317335
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.
318336

319337
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.
320338

321339
Let's see how to blink a LED. The traditional way involves the `delay()` function:
322340

323-
void loop() {
324-
ArduinoCloud.update();
325-
326-
digitalWrite(LED_BUILTIN, HIGH);
327-
delay(1000);
328-
digitalWrite(LED_BUILTIN, LOW);
329-
delay(1000);
330-
}
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+
```
331351

332352
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.
333353

334354
This can be rewritten in a non-blocking way as follows:
335355

336-
void loop() {
337-
ArduinoCloud.update();
338-
339-
digitalWrite(LED_PIN, (millis() % 2000) < 1000);
340-
}
356+
```arduino
357+
void loop() {
358+
ArduinoCloud.update();
359+
360+
digitalWrite(LED_PIN, (millis() % 2000) < 1000);
361+
}
362+
```
341363

342364
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.
343365

344366
For a more complex and commented example, you can have a look at the [BlinkWithoutDelay example](/built-in-examples/digital/BlinkWithoutDelay).
345367

346-
### 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:
373+
374+
```arduino
375+
void setup() {
376+
Serial.begin(9600);
377+
delay(1500);
378+
379+
initProperties();
380+
381+
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
382+
setDebugMessageLevel(2);
383+
ArduinoCloud.printDebugInfo();
384+
385+
//initializing the Arduino_MKRENV library
386+
if (!ENV.begin()) {
387+
Serial.println("Failed to initialize MKR ENV shield!");
388+
while (1);
389+
}
390+
```
391+
392+
393+
### Avoid Blocking Serial Communication
347394

348395
`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.
349396

@@ -358,7 +405,7 @@ We provide two Arduino Iot Cloud APIs:
358405

359406
The Arduino IoT Cloud REST API can be called just with any **HTTP Client**, or using one of these clients:
360407
- [Javascript NPM package](https://www.npmjs.com/package/@arduino/arduino-iot-client).
361-
- [Python PYPI Package](https://pypi.org/project/arduino-iot-client/).
408+
- [Python® PYPI Package](https://pypi.org/project/arduino-iot-client/).
362409
- [Golang Module](https://github.com/arduino/iot-client-go).
363410

364411
**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.

content/arduino-cloud/01.getting-started/04.cloud-lora-getting-started/cloud-lora-getting-started_.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ You can visit the [Activate an Arduino Pro Gateway with IoT Cloud](https://suppo
270270
### Migrate Existing Gateway
271271

272272

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.
274274

275275
To perform the Arduino Pro gateway migration:
276276

content/arduino-cloud/01.getting-started/06.cloud-variables/cloud-variables.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,24 @@ void onTvChange() {
491491
492492
```
493493

494+
## Alexa Variables
495+
496+
The integration between Alexa & Arduino IoT Cloud supports a limited amount of variables, see the list below:
497+
498+
- [Colored Light](#coloredlight) - `bool` and `float` (complex type).
499+
- [Dimmed Light](#dimmedlight) - `bool` and `float` (complex type).
500+
- [Television](#television) - `bool` and `int` (complex type)
501+
- [Contact Sensor](#specialized-types) - `bool`
502+
- [Light](#specialized-types) - `bool`
503+
- [Motion Sensor](#specialized-types) - `bool`
504+
- [Smart Plug](#specialized-types) - `bool`
505+
- [Switch](#specialized-types) - `bool`
506+
- [Temperature Sensor](#specialized-types) - `float`
507+
508+
Other variables used will not appear in the Amazon Alexa app.
509+
510+
***To synchronize your Arduino Cloud with the Amazon Alexa service, you can check out the [Arduino Cloud Alexa Tutorial](/arduino-cloud/tutorials/alexa-mkr-rgb-shield).***
511+
494512
## Summary
495513

496514
In this article, we have covered how to use variables in the Arduino IoT Cloud, and what variables are available.

0 commit comments

Comments
 (0)