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: content/arduino-cloud/03.cloud-interface/00.sketches/sketches.md
+11-5
Original file line number
Diff line number
Diff line change
@@ -70,11 +70,6 @@ The sketch file is generated with a set of additional Cloud-specific methods inc
70
70
-`ArduinoCloud.begin()` starts the library with the preferred connection (e.g. Wi-Fi® or LoRaWAN®).
71
71
-`ArduinoCloud.update()` - synchronizes all data between the board and the Arduino Cloud.
72
72
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
-
78
73
In addition, any variable created with a read/write permission will also generate a callback function that executes whenever the variable's value changes.
79
74
- If you create a variable called `test`, the function will render as `void onTestChange(){}`
80
75
@@ -108,6 +103,17 @@ void onTestChange(){
108
103
}
109
104
```
110
105
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
+
111
117
### Configuration Header File
112
118
113
119
The `thingProperties.h` file is a non-editable file that updates based on changes made in your Thing. For example:
0 commit comments