Skip to content

Commit 38fedcf

Browse files
Changed place for text
1 parent c94929b commit 38fedcf

File tree

1 file changed

+11
-5
lines changed
  • content/arduino-cloud/03.cloud-interface/00.sketches

1 file changed

+11
-5
lines changed

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

+11-5
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@ The sketch file is generated with a set of additional Cloud-specific methods inc
7070
- `ArduinoCloud.begin()` starts the library with the preferred connection (e.g. Wi-Fi® or LoRaWAN®).
7171
- `ArduinoCloud.update()` - synchronizes all data between the board and the Arduino Cloud.
7272

73-
There are a few different options when it comes to synchronization of your cloud sketch:
74-
- `MOST_RECENT_WINS` - Best for real-time applications where the latest data should always be used, regardless of source.
75-
- `CLOUD_WINS` - Useful when the cloud holds critical configurations or settings that should always be enforced on the device.
76-
- `DEVICE_WINS` - Used when the device generates important real-time data (sensor readings) that should always be preserved over cloud updates.
77-
7873
In addition, any variable created with a read/write permission will also generate a callback function that executes whenever the variable's value changes.
7974
- If you create a variable called `test`, the function will render as `void onTestChange(){}`
8075

@@ -108,6 +103,17 @@ void onTestChange(){
108103
}
109104
```
110105

106+
There are a few different options when it comes to synchronization of your cloud sketch:
107+
- `MOST_RECENT_WINS` - The latest update whether from the device or the cloud is used. Best for real-time applications where the latest data should always be used, regardless of source.
108+
- `CLOUD_WINS` - The cloud value always overwrites the device value. Useful when the cloud holds critical configurations or settings that should always be enforced on the device.
109+
- `DEVICE_WINS` - The device value always overwrites the cloud value. Used when the device generates important real-time data (sensor readings) that should always be preserved over cloud updates.
110+
111+
It can be set in your sketch with:
112+
113+
```arduino
114+
setSyncPolicy(MOST_RECENT_WINS); // or CLOUD_WINS, DEVICE_WINS
115+
```
116+
111117
### Configuration Header File
112118

113119
The `thingProperties.h` file is a non-editable file that updates based on changes made in your Thing. For example:

0 commit comments

Comments
 (0)