Skip to content

Commit 0f8a59b

Browse files
committed
review
1 parent a07de23 commit 0f8a59b

File tree

5 files changed

+80
-78
lines changed

5 files changed

+80
-78
lines changed

content/arduino-cloud/03.cloud-interface/00.sketches/sketches.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ A sketch is a file where we write programs to run on our Arduino boards. Sketche
99

1010
The Arduino Cloud has two categories of sketches:
1111
- **Regular sketch** - a single `.ino` file where you write a program. These sketches can be used for **any** Arduino board.
12-
- **IoT Sketch** - a set of files that are automatically generated when creating a [Thing](/arduino-cloud/cloud-interface/things). This includes a `.ino` file, and two header (`.h`) files that contains your Thing configuration + credentials. Only available for boards with IoT support.
12+
- **IoT Sketch** - a set of files that are automatically generated when creating a [Thing](/arduino-cloud/cloud-interface/things). This includes an `.ino` file and two header (`.h`) files that contain your Thing configuration + credentials. Only available for boards with IoT support.
1313

1414
In this document we will take a look at how to use sketches in the Arduino Cloud environment.
1515

16-
***If you need help getting started with programming your Arduino in the online environment, check out the [Cloud Editor](/arduino-cloud/guides/cloud-editor) tutorial.
16+
***If you need help getting started with programming your Arduino in the online environment, check out the [Cloud Editor](/arduino-cloud/guides/cloud-editor) tutorial.***
1717

1818
## Access Your Sketches
1919

20-
You can access all your sketches at [app.arduino.cc/sketches](app.arduino.cc/sketches), where you can easily select between your regular sketches, and IoT sketches.
20+
You can access all your sketches at [app.arduino.cc/sketches](https://app.arduino.cc/sketches), where you can easily select between your regular sketches and IoT sketches.
2121

2222
![Sketches in the Arduino Cloud.](assets/sketch.png)
2323

@@ -27,7 +27,7 @@ Clicking on each sketch will direct you to the [Cloud Editor](https://create.ard
2727

2828
## Regular Sketches
2929

30-
A regular sketch in the Arduino Cloud are exactly like sketches used in the [Arduino IDE](/software/ide-v2), with no difference whatsoever. You can take a sketch from the online IDE and compile it in the offline IDE.
30+
A regular sketch in the Arduino Cloud is exactly like a sketch used in the [Arduino IDE](/software/ide-v2), with no difference whatsoever. You can take a sketch from the online IDE and compile it in the offline IDE.
3131

3232
A regular sketch only has two minimum requirements: the inclusion of the `void loop()` and `void setup()` functions, which are required for any Arduino sketch.
3333

@@ -47,18 +47,18 @@ For specific features of a board, make sure to check out the [hardware documenta
4747

4848
## IoT Sketches
4949

50-
IoT sketches are more complex, and are generated automatically when you create a Thing and variables.
50+
IoT sketches are more complex and are generated automatically when you create a Thing and variables.
5151

5252
***Read more about this in the [Automatic Sketch Generation](/arduino-cloud/cloud-interface/sketches) documentation.***
5353

5454
### Sketch File
5555

56-
This sketch file is generated with a set of additional cloud specific methods included, the essentials being:
56+
The sketch file is generated with a set of additional cloud-specific methods included, the essentials being:
5757
- `initProperties()` - initializes properties/variables from your Thing.
5858
- `ArduinoCloud.begin()` starts the library with the preferred connection (e.g. Wi-Fi® or LoRaWAN®).
59-
- `ArduinoCloud.update()` - synchronizing all data between board and Arduino Cloud
59+
- `ArduinoCloud.update()` - synchronizes all data between the board and the Arduino Cloud.
6060

61-
In addition, any variables created with a read/write permission will also generate a callback function that executes whenever the variable's value changes.
61+
In addition, any variable created with a read/write permission will also generate a callback function that executes whenever the variable's value changes.
6262
- If you create a variable called `test`, the function will render as `void onTestChange(){}`
6363

6464
Below is an example of how a default sketch looks like:
@@ -96,17 +96,17 @@ void onTestChange(){
9696
The `thingProperties.h` file is a non-editable file that updates based on changes made in your Thing. For example:
9797

9898
- Creating a variable will add it to this file, along with parameters such as permission, update policy, variable type etc.
99-
- Changing from a Wi-Fi® device to LoRa® device will update the **connection method** stored in this file,
99+
- Changing from a Wi-Fi® device to a LoRa® device will update the **connection method** stored in this file,
100100

101101
The file cannot be edited in the Arduino Cloud as it is in sync with the platform and changes frequently.
102102

103103
### Secret File
104104

105105
The "Secret" File contains your secret credentials, such as Wi-Fi® network SSID/PASS or device secret key.
106106

107-
This file will be visible as a "Secret" tab in the Cloud Editor, and is named `arduino_secrets.h`, which is not visible in the cloud platform.
107+
This file will be visible as a "Secret" tab in the Cloud Editor and is named `arduino_secrets.h`, which is not visible on the cloud platform.
108108

109-
Note that if you are using the offline IDE / Arduino CLI instead, you will manually need to create this file. More information in the **Offline Sketches section** just below.
109+
Note that if you are using the offline IDE / Arduino CLI, you will need to manually create this file. More information is in the **Offline Sketches section** just below.
110110

111111
## Offline Sketches
112112

@@ -144,11 +144,11 @@ ArduinoCloud.begin(ArduinoIoTPreferredConnection, false).
144144

145145
### Alternatives to Delays
146146

147-
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.
147+
The `loop()` function includes the `ArduinoCloud.update();` call, which sends data to the cloud and receives updates. 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.
148148

149149
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.
150150

151-
Let's see how to blink a LED. The traditional way involves the `delay()` function:
151+
Let's see how to blink an LED. The traditional way involves the `delay()` function:
152152

153153
```arduino
154154
void loop() {
@@ -179,7 +179,7 @@ For a more complex and commented example, you can have a look at the [BlinkWitho
179179

180180
### I2C Usage
181181

182-
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.
182+
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** crypto chip. 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.
183183

184184
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:
185185

@@ -199,19 +199,20 @@ void setup() {
199199
Serial.println("Failed to initialize MKR ENV shield!");
200200
while (1);
201201
}
202+
}
202203
```
203204

204205

205206
### Avoid Blocking Serial Communication
206207

207208
`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.
208209

209-
A common trick is to add a **`delay(1500);` command after `Serial.begin(9600);`**. This will slightly slow down the initialization of your device, but will give you some time to open the serial monitor when you're interested in seeing its output within losing the very first lines.
210+
A common trick is to add a **`delay(1500);` command after `Serial.begin(9600);`**. This will slightly slow down the initialization of your device but will give you some time to open the serial monitor when you're interested in seeing its output without losing the very first lines.
210211

211212
## Create Agent
212213

213214
The [Arduino Create Agent](https://github.com/arduino/arduino-create-agent) is a single binary that will appear on the menu bar and work in the background. It allows you to use the Arduino IoT Cloud and the Arduino Web Editor to seamlessly upload code to any board directly from the browser.
214215

215-
Downloading and installing the Arduino Create Agent plugin can be simply done following [this quick and easy process](https://create.arduino.cc/getting-started/plugin/welcome).
216+
Downloading and installing the Arduino Create Agent plugin can be done following [this quick and easy process](https://create.arduino.cc/getting-started/plugin/welcome).
216217

217218
The full documentation of the [Arduino Create Agent is available here](https://github.com/arduino/arduino-create-agent#readme) for more advanced usage.

content/arduino-cloud/03.cloud-interface/01.things/things.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ In the Thing interface you can:
1212
- select the main device you want to associate with,
1313
- enter network credentials (such as Wi-Fi network/password),
1414
- edit & upload sketches to your board,
15-
- set webhooks that trigger whenever data changes.
15+
- set webhooks that trigger whenever data changes,
1616
- edit the timezone.
1717

1818
## Thing Interface
1919

20-
The Thing interface is designed for ease-of-use, and only has a few sections, which we will now go through.
20+
The Thing interface is designed for ease-of-use and only has a few sections, which we will now go through.
2121

2222
![Thing Interface](assets/thing-interface.png)
2323

@@ -32,7 +32,7 @@ Below you will find more details on each of the sections.
3232

3333
## Variables
3434

35-
The variables section is where you create **"Cloud Variables"**, a variable that exist in the Arduino Cloud as well as on your board/setup, and are synchronised continuously. You can configure a variable to be:
35+
The variables section is where you create **"Cloud Variables"**, a variable that exist in the Arduino Cloud as well as on your board/setup, and is synchronized continuously. You can configure a variable to be:
3636
- **Read/Write** - you can interact with the variable from a dashboard,
3737
- **Read Only** - you can only read data from the board.
3838

@@ -48,18 +48,18 @@ temperature = sensor.readTemperature();
4848

4949
There are a large number of variables available, including basic types such as `int`, `boolean` & `String`, but also complex types that hold multiple values, such as the `ColoredLight` variable.
5050

51-
Variables of the same type can also be synchronised across all devices. This is done when creating a new variable, where you check the variables you want to sync with.
51+
Variables of the same type can also be synchronized across all devices. This is done when creating a new variable, where you check the variables you want to sync with.
5252

53-
***All variables are listed out in the [Variables](/arduino-cloud/cloud-interface/variables) section. See [Variable Synchronization](/arduino-cloud/cloud-interface/variables#variable-synchronisation) for linking together your devices' variables.***
53+
***All variables are listed in the [Variables](/arduino-cloud/cloud-interface/variables) section. See [Variable Synchronization](/arduino-cloud/cloud-interface/variables#variable-synchronisation) for linking together your devices' variables.***
5454

5555
## Device
5656

57-
In the device section you can select either a previously configured device, or configure a new one. Associating a device means your device and Thing are now linked indefinitely, until you decide to detach them.
57+
In the device section, you can select either a previously configured device, or configure a new one. Associating a device means your device and Thing are now linked indefinitely until you decide to detach them.
5858

5959
You can connect one of the following devices:
6060
- [Arduino Wi-Fi® devices](/arduino-cloud/hardware/wifi) - official Arduino devices with a Wi-Fi® enabled module.
6161
- [Arduino LoRaWAN® devices](/arduino-cloud/hardware/lora) - official Arduino devices with a LoRaWAN® module.
62-
- [Third party ESP32/ESP8266 devices](/arduino-cloud/hardware/wifi) - third party devices with an ESP32/ESP8266 SoC.
62+
- [Third-party ESP32/ESP8266 devices](/arduino-cloud/hardware/wifi) - third party devices with an ESP32/ESP8266 SoC.
6363
- [Manual devices](/arduino-cloud/hardware/devices#manual-devices) - a virtual device using MicroPython, Python or JavaScript. These devices do not have a sketch associated.
6464

6565
The status of your device is also displayed in this section (online/offline).
@@ -68,11 +68,11 @@ The status of your device is also displayed in this section (online/offline).
6868

6969
## Network
7070

71-
In the network section, you configure the credentials for your network, such as your Wi-Fi® network, secret key (for ESP32 boards) and other credentials for e.g. LoRaWAN® & cellular. The network details are securely stored.
71+
In the network section, you configure the credentials for your network, such as your Wi-Fi® network, secret key (for ESP32 boards) and other credentials e.g. LoRaWAN® & cellular. The network details are securely stored.
7272

7373
![Network configuration.](assets/network-creds.png)
7474

75-
The credentials entered are automatically included in your sketch (see automatic sketch generation just below).
75+
The credentials entered are automatically included in your sketch (see [automatic sketch generation](#automatic-sketch-generation)).
7676

7777
## Sketch
7878

@@ -95,7 +95,7 @@ The editor includes all cores for official Arduino boards, and over 6000+ librar
9595

9696
## Metadata
9797

98-
In the metadata tab you will find your **Thing ID**, **Timezone** configuration, timestamp data (creation/last modified). Here you can also create tags
98+
In the metadata tab, you will find your **Thing ID**, **Timezone** configuration, timestamp data (creation/last modified). Here you can also create tags.
9999

100100
### Thing ID
101101

@@ -109,7 +109,7 @@ This ID is used when connecting with the [REST API](/arduino-cloud/api/arduino-i
109109

110110
### Timezone
111111

112-
You can choose your timezone through a dropdown menu in the metadata tab, which includes many cities from the Americas, Europe, Asia, Africa, Oceania, Atlantic, Pacific and even Antarctica.
112+
You can choose your timezone through a dropdown menu in the metadata tab, which includes many cities in America, Europe, Asia, Africa, Oceania, Atlantic, Pacific and even Antarctica.
113113

114114
This is particularly important when using the [scheduler](/arduino-cloud/features/cloud-scheduler) feature to trigger events at specific times.
115115

@@ -121,14 +121,14 @@ Tags are used to organize and filter your Things. In a setup with many devices a
121121

122122
## Automatic Sketch Generation
123123

124-
Things based on Arduino / C++ (the default way) benefits from **automatic sketch generation**. Whenever any configuration is done in your Thing, the changes are reflected in your sketch files.
124+
Things based on Arduino / C++ (the default way) benefit from **automatic sketch generation**. Whenever the configuration is done in your Thing, the changes are reflected in your sketch files.
125125

126126
For example:
127-
- Associating a Wi-Fi board will automatically update the connection method,
128-
- creating a variable will add it to your `thingProperties.h` file,
129-
- creating a variable with **read/write** permission will also add a callback function at the bottom of your sketch. This will trigger anytime the value changes.
130-
- changing your network credentials will update the `arduino_secrets.h` file.
127+
- Associating a Wi-Fi board will automatically update the connection method.
128+
- Creating a variable will add it to your `thingProperties.h` file.
129+
- Creating a variable with **read/write** permission will also add a callback function at the bottom of your sketch. This will trigger any time the value changes.
130+
- Changing your network credentials will update the `arduino_secrets.h` file.
131131

132-
This is implemented so that the connection and synchronisation between the board and cloud is handled automatically, meaning you do not need to do any networking code when using the Arduino / C++ language.
132+
This is implemented so that the connection and synchronization between the board and cloud is handled automatically, meaning you do not need to do any networking code when using the Arduino / C++ language.
133133

134134
***Please note that if you are using an offline environment, [Arduino IDE](/software/ide-v2), changes will only be made in the cloud environment and will manually need to be adjusted. If you plan on using the offline IDE, you make use of the [sketch synchronisation](/software/ide-v2/tutorials/ide-v2-cloud-sketch-sync) feature that allows you to push/pull your cloud sketches from the offline IDE.***

0 commit comments

Comments
 (0)