Skip to content

Commit c2e52cb

Browse files
committed
added utilities
1 parent f9c42f7 commit c2e52cb

File tree

1 file changed

+40
-13
lines changed

1 file changed

+40
-13
lines changed

content/cloud/iot-cloud/tutorials/02.technical-reference/iot-cloud-tech-ref.md

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -262,26 +262,24 @@ Declared as `CloudColor x;`.
262262

263263
To read the Color values, we can use the following method `Color colorValues = x.getValue();`. This will assign the hue, saturation, and brightness values to the `colorValues` variable.
264264

265-
| Property | Type | Read value | Set value |
266-
| ---------- | ---- | ----------------- | -------------------------------------- |
267-
| Hue | | `colorValues.hue` | `x = Color(hue,saturation,brightness)` |
268-
| Saturation | | `colorValues.sat` | `x = Color(hue,saturation,brightness)` |
269-
| Brightness | | `colorValues.bri` | `x = Color(hue,saturation,brightness)` |
270-
271-
272-
273-
274-
To read the Color values, we can use the following method `Color colorValues = x.getValue();`. This will assign the hue, saturation, and brightness values to the `colorValues` variable. If we want too access the values individually we can use `Serial.println(colorValues.hue)`, `Serial.println(colorValues.sat)`, and `Serial.println(colorValues.bri)`.
265+
| Property | Type | Read value | Set value |
266+
| ---------- | ------- | ----------------- | -------------------------------------- |
267+
| Hue | `float` | `colorValues.hue` | `x = Color(hue,saturation,brightness)` |
268+
| Saturation | `float` | `colorValues.sat` | `x = Color(hue,saturation,brightness)` |
269+
| Brightness | `float` | `colorValues.bri` | `x = Color(hue,saturation,brightness)` |
275270

276271
To set the color, we can assign the CloudColor variable directly to float variables `x = {hue,saturation,brightness}`, or using the method ` x = Color(hue,saturation,brightness)`.
277272

278273
#### CloudLocation
279274

280-
Declared as `CloudLocation x;`
275+
Declared as `CloudLocation x;`.
281276

282-
To read the location values, we can use the following method `Location coordinates = x.getValue();`. This will assign the longitude and latitude values to the coordinates variable. If we want too access the values individually we can use `Serial.println(coordinates.lat)` and `Serial.println(coordinates.lat)`.
277+
To read the location values, we can use the following method `Location coordinates = x.getValue();`. This will assign the longitude and latitude values to the coordinates variable. If we want too access the values individually we can use `Serial.println(coordinates.lat)` and `Serial.println(coordinates.lot)`.
283278

284-
To set the coordinates, we can assign the CloudLocation variable directly to float variables `x = {latitude, longitude}`, or using the method ` x = Location(latitude, longitude)`.
279+
| Property | Type | Read value | Set value |
280+
| --------- | ------- | ----------------- | --------------------------- |
281+
| Latitude | `float` | `coordinates.lat` | This variable is ready only |
282+
| Longitude | `float` | `coordinates.lon` | This variable is ready only |
285283

286284
#### Television
287285

@@ -297,6 +295,35 @@ Declared as `CloudTelevision x;`
297295
| Channel | `int` | `x.getChannel()` | `x.setChannel()` |
298296

299297

298+
### Utilities
299+
300+
The following utilities are available using any IoT Cloud sketch.
301+
302+
#### Check Connection Status
303+
304+
To check connection to the cloud, use:
305+
306+
```arduino
307+
ArduinoCloud.connected()
308+
```
309+
310+
This will return in an `int` format:
311+
- `0` (not connected)
312+
- `1` (connected).
313+
314+
#### Get Local Time (Unix)
315+
316+
To check local time, use:
317+
318+
```arduino
319+
ArduinoCloud.getLocalTime()
320+
```
321+
322+
This will return in a `long` format:
323+
- Epoch Unix time stamp. Example: `1652442415`.
324+
325+
***This utility can be used together with the `CloudTime` variable and the `Time Picker` widget.***
326+
300327
### Examples
301328

302329
Here are some examples of how to use the variables in a sketch:

0 commit comments

Comments
 (0)