Skip to content

Commit 2e6aec5

Browse files
authored
Merge pull request #235 from arduino/karlsoderby/iot-cloud-cheat-sheet-fixes
[MKC-461] IoT Cloud CS Fixes
2 parents a715634 + 9f7823a commit 2e6aec5

File tree

1 file changed

+97
-57
lines changed

1 file changed

+97
-57
lines changed

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

Lines changed: 97 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -192,44 +192,44 @@ For your convenience, IoT Cloud provides specialized types which are just wrappe
192192
You can use them just like a normal variable of the wrapped type, since they support assignment and comparison operators.
193193

194194
| Type | Declaration | Wrapped data type |
195-
| -------------------- | ---------------------------------------- | ------- |
196-
| Acceleration | `CloudAcceleration variableName;` | `float` |
197-
| Angle | `CloudAngle variableName;` | `float` |
198-
| Area | `CloudArea variableName;` | `float` |
199-
| Capacitance | `CloudCapacitance variableName;` | `float` |
200-
| Color | `CloudColor variableName;` | `float` |
201-
| Contact Sensor | `CloudContactSensor variableName;` | `bool` |
202-
| Counter | `CloudCounter variableName;` | `int` |
203-
| Data Rate | `CloudDataRate variableName;` | `float` |
204-
| Electric Current | `CloudElectricCurrent variableName;` | `float` |
205-
| Electric Potention | `CloudElectricPotention variableName;` | `float` |
206-
| Electric Resistance | `CloudElectricResistance variableName;` | `float` |
207-
| Energy | `CloudEnergy variableName;` | `float` |
208-
| Flow Rate | `CloudFlowRate variableName;` | `float` |
209-
| Force | `CloudForce variableName;` | `float` |
210-
| Frequency | `CloudFrequency variableName;` | `float` |
211-
| Heart Rate | `CloudHeartRate variableName;` | `float` |
212-
| Information Content | `CloudInformationContent variableName;` | `int` |
213-
| Length | `CloudLength variableName;` | `float` |
214-
| Light | `CloudLight variableName;` | `bool` |
215-
| Location | `CloudLocation variableName;` | `float` |
216-
| Logarithmic Quantity | `CloudLogarithmicQuantity variableName;` | `float` |
217-
| Luminance | `CloudLuminance variableName;` | `float` |
218-
| Luminous Flux | `CloudLuminousFlux variableName;` | `float` |
219-
| Luminous Intensity | `CloudLuminousIntensity variableName;` | `float` |
220-
| Mass | `CloudMass variableName;` | `float` |
221-
| Motion Sensor | `CloudMotionSensor variableName;` | `bool` |
222-
| Percentage | `CloudPercentage variableName;` | `float` |
223-
| Power | `CloudPower variableName;` | `float` |
224-
| Pressure | `CloudPressure variableName;` | `float` |
225-
| Relative Humidity | `CloudRelativeHumidity variableName;` | `float` |
226-
| Smart Plug | `CloudSmartPlug variableName;` | `bool` |
227-
| Switch | `CloudSwitch variableName;` | `bool` |
228-
| CloudTemperature | `CloudTemperature variableName;` | `float` |
229-
| Temperature Sensor | `CloudTemperatureSensor variableName;` | `float` |
230-
| Time | `CloudTime variableName;` | `float` |
231-
| Velocity | `CloudVelocity variableName;` | `float` |
232-
| Volume | `CloudVolume variableName;` | `float` |
195+
| -------------------- | ---------------------------------------- | ----------------- |
196+
| Acceleration | `CloudAcceleration variableName;` | `float` |
197+
| Angle | `CloudAngle variableName;` | `float` |
198+
| Area | `CloudArea variableName;` | `float` |
199+
| Capacitance | `CloudCapacitance variableName;` | `float` |
200+
| Color | `CloudColor variableName;` | `float` |
201+
| Contact Sensor | `CloudContactSensor variableName;` | `bool` |
202+
| Counter | `CloudCounter variableName;` | `int` |
203+
| Data Rate | `CloudDataRate variableName;` | `float` |
204+
| Electric Current | `CloudElectricCurrent variableName;` | `float` |
205+
| Electric Potention | `CloudElectricPotention variableName;` | `float` |
206+
| Electric Resistance | `CloudElectricResistance variableName;` | `float` |
207+
| Energy | `CloudEnergy variableName;` | `float` |
208+
| Flow Rate | `CloudFlowRate variableName;` | `float` |
209+
| Force | `CloudForce variableName;` | `float` |
210+
| Frequency | `CloudFrequency variableName;` | `float` |
211+
| Heart Rate | `CloudHeartRate variableName;` | `float` |
212+
| Information Content | `CloudInformationContent variableName;` | `int` |
213+
| Length | `CloudLength variableName;` | `float` |
214+
| Light | `CloudLight variableName;` | `bool` |
215+
| Location | `CloudLocation variableName;` | `float` |
216+
| Logarithmic Quantity | `CloudLogarithmicQuantity variableName;` | `float` |
217+
| Luminance | `CloudLuminance variableName;` | `float` |
218+
| Luminous Flux | `CloudLuminousFlux variableName;` | `float` |
219+
| Luminous Intensity | `CloudLuminousIntensity variableName;` | `float` |
220+
| Mass | `CloudMass variableName;` | `float` |
221+
| Motion Sensor | `CloudMotionSensor variableName;` | `bool` |
222+
| Percentage | `CloudPercentage variableName;` | `float` |
223+
| Power | `CloudPower variableName;` | `float` |
224+
| Pressure | `CloudPressure variableName;` | `float` |
225+
| Relative Humidity | `CloudRelativeHumidity variableName;` | `float` |
226+
| Smart Plug | `CloudSmartPlug variableName;` | `bool` |
227+
| Switch | `CloudSwitch variableName;` | `bool` |
228+
| CloudTemperature | `CloudTemperature variableName;` | `float` |
229+
| Temperature Sensor | `CloudTemperatureSensor variableName;` | `float` |
230+
| Time | `CloudTime variableName;` | `float` |
231+
| Velocity | `CloudVelocity variableName;` | `float` |
232+
| Volume | `CloudVolume variableName;` | `float` |
233233

234234

235235
### Complex Types
@@ -249,42 +249,82 @@ Declared as `CloudDimmedLight x;`
249249

250250
Declared as `CloudColoredLight x;`
251251

252-
| Property | Type | Read value | Set value |
253-
| ----------| -------------------| -------------------------------| ------------------------------|
254-
| Switch | `bool` | `x.getSwitch()` | `x.setSwitch()` |
255-
| Hue | `float` (0-360) | `x.getHue()` | `x.setHue()` |
256-
| Saturation| `float` (0-100) | `x.getSaturation()` | `x.setSaturation()` |
257-
| Brightness| `float` (0-100) | `x.getBrightness()` | `x.setBrightness()` |
252+
| Property | Type | Read value | Set value |
253+
| ---------- | --------------- | ------------------- | ------------------- |
254+
| Switch | `bool` | `x.getSwitch()` | `x.setSwitch()` |
255+
| Hue | `float` (0-360) | `x.getHue()` | `x.setHue()` |
256+
| Saturation | `float` (0-100) | `x.getSaturation()` | `x.setSaturation()` |
257+
| Brightness | `float` (0-100) | `x.getBrightness()` | `x.setBrightness()` |
258258

259259
#### CloudColor
260260

261-
Declared as `CloudColor x;`
261+
Declared as `CloudColor x;`.
262+
263+
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.
262264

263-
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)` |
264270

265271
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)`.
266272

267273
#### CloudLocation
268274

269-
Declared as `CloudLocation x;`
275+
Declared as `CloudLocation x;`.
276+
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.lon)`.
270278

271-
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)`.
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 |
272283

273-
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)`.
284+
***The format of the `lat` and `lon` is in Decimal Degrees (DD), for example `41.40338`, `2.17403`.***
274285

275286
#### Television
276287

277288
Declared as `CloudTelevision x;`
278289

279-
| Property | Type | Read Value | Set value |
280-
| -----------------| ---------------------------------------------------------------------------------------| -------------------------| -------------------------|
281-
| Switch | `bool` | `x.getSwitch()` | `x.setSwitch()` |
282-
| Volume | `int`(0-100) | `x.getVolume()` | `x.setVolume()` |
283-
| Mute | `bool` | `x.getMute()` | `x.setMute()` |
284-
| PlaybackCommands | `PlaybackCommands` (FastForward, Next, Pause, Play, Previous, Rewind, StartOver, Stop) | `x.getPlaybackCommand()` | `x.setPlaybackCommand()` |
285-
| Input | `InputValue` ([Up to 60 values](https://github.com/arduino-libraries/ArduinoIoTCloud/blob/master/src/property/types/automation/CloudTelevision.h) such as HDMI1, HDMI2, DVD, GAME...etc.) | `x.getInput()` | `x.setInput()` |
286-
| Channel | `int` | `x.getChannel()` | `x.setChannel()` |
290+
| Property | Type | Read Value | Set value |
291+
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | ------------------------ |
292+
| Switch | `bool` | `x.getSwitch()` | `x.setSwitch()` |
293+
| Volume | `int`(0-100) | `x.getVolume()` | `x.setVolume()` |
294+
| Mute | `bool` | `x.getMute()` | `x.setMute()` |
295+
| PlaybackCommands | `PlaybackCommands` (FastForward, Next, Pause, Play, Previous, Rewind, StartOver, Stop) | `x.getPlaybackCommand()` | `x.setPlaybackCommand()` |
296+
| Input | `InputValue` ([Up to 60 values](https://github.com/arduino-libraries/ArduinoIoTCloud/blob/master/src/property/types/automation/CloudTelevision.h) such as HDMI1, HDMI2, DVD, GAME...etc.) | `x.getInput()` | `x.setInput()` |
297+
| Channel | `int` | `x.getChannel()` | `x.setChannel()` |
298+
299+
300+
### Utilities
301+
302+
The following utilities are available using any IoT Cloud sketch.
303+
304+
#### Check Connection Status
305+
306+
To check connection to the cloud, use:
307+
308+
```arduino
309+
ArduinoCloud.connected()
310+
```
311+
312+
This will return in an `int` format:
313+
- `0` (not connected)
314+
- `1` (connected).
315+
316+
#### Get Local Time (Unix)
317+
318+
To check local time, use:
319+
320+
```arduino
321+
ArduinoCloud.getLocalTime()
322+
```
323+
324+
This will return in a `long` format:
325+
- Epoch Unix time stamp. Example: `1652442415`.
287326

327+
***This utility can be used together with the `CloudTime` variable and the `Time Picker` widget.***
288328

289329
### Examples
290330

0 commit comments

Comments
 (0)