|
| 1 | +# Arduino MKR ENV library |
| 2 | + |
| 3 | +## Methods |
| 4 | + |
| 5 | +### `begin()` |
| 6 | + |
| 7 | +Initialize the sensors on the shield. |
| 8 | + |
| 9 | +#### Syntax |
| 10 | + |
| 11 | +``` |
| 12 | +ENV.begin() |
| 13 | +``` |
| 14 | + |
| 15 | +#### Parameters |
| 16 | + |
| 17 | +None. |
| 18 | + |
| 19 | +#### Returns |
| 20 | + |
| 21 | +1 on success, 0 on failure. |
| 22 | + |
| 23 | +#### Example |
| 24 | + |
| 25 | +``` |
| 26 | +if (!ENV.begin()) { |
| 27 | + Serial.println("Failed to initialize MKR ENV shield!"); |
| 28 | + while (1); |
| 29 | +} |
| 30 | +``` |
| 31 | + |
| 32 | +#### See also |
| 33 | + |
| 34 | +* [end()](#end) |
| 35 | +* [readTemperature()](#readTemperature) |
| 36 | +* [readHumidity()](#readHumidity) |
| 37 | +* [readPressure()](#readPressure) |
| 38 | +* [readIlluminance()](#readIlluminance) |
| 39 | +* [readUVA()](#readUVA) |
| 40 | +* [readUVB()](#readUVB) |
| 41 | +* [readUVIndex()](#readUVIndex) |
| 42 | + |
| 43 | +### `end()` |
| 44 | + |
| 45 | +De-initialize the sensors on the shield. |
| 46 | + |
| 47 | +#### Syntax |
| 48 | + |
| 49 | +``` |
| 50 | +ENV.end() |
| 51 | +``` |
| 52 | + |
| 53 | +#### Parameters |
| 54 | + |
| 55 | +None. |
| 56 | + |
| 57 | +#### Returns |
| 58 | + |
| 59 | +None. |
| 60 | + |
| 61 | +#### Example |
| 62 | + |
| 63 | +``` |
| 64 | +ENV.end(); |
| 65 | +``` |
| 66 | + |
| 67 | +#### See also |
| 68 | + |
| 69 | +* [begin()](#begin) |
| 70 | +* [readTemperature()](#readTemperature) |
| 71 | +* [readHumidity()](#readHumidity) |
| 72 | +* [readPressure()](#readPressure) |
| 73 | +* [readIlluminance()](#readIlluminance) |
| 74 | +* [readUVA()](#readUVA) |
| 75 | +* [readUVB()](#readUVB) |
| 76 | +* [readUVIndex()](#readUVIndex) |
| 77 | + |
| 78 | +### `readTemperature()` |
| 79 | + |
| 80 | +Read the temperature sensor's value. If no unit is specified as parameter, the value will be expressed in Celsius. |
| 81 | + |
| 82 | +#### Syntax |
| 83 | + |
| 84 | +``` |
| 85 | +ENV.readTemperature(unit) |
| 86 | +``` |
| 87 | + |
| 88 | +#### Parameters |
| 89 | + |
| 90 | +* _unit_: FAHRENHEIT to get the temperature in Fahrenheit and CELSIUS to get the temperature in Celsius (default). |
| 91 | + |
| 92 | +#### Returns |
| 93 | + |
| 94 | +The sensor’s temperature value as float in the specified unit. |
| 95 | + |
| 96 | +#### Example |
| 97 | + |
| 98 | +``` |
| 99 | +Serial.print("Temperature = "); |
| 100 | +Serial.print(ENV.readTemperature()); |
| 101 | +Serial.println(" °C"); |
| 102 | +``` |
| 103 | + |
| 104 | +#### See also |
| 105 | + |
| 106 | +* [begin()](#begin) |
| 107 | +* [end()](#end) |
| 108 | +* [readHumidity()](#readHumidity) |
| 109 | +* [readPressure()](#readPressure) |
| 110 | +* [readIlluminance()](#readIlluminance) |
| 111 | +* [readUVA()](#readUVA) |
| 112 | +* [readUVB()](#readUVB) |
| 113 | +* [readUVIndex()](#readUVIndex) |
| 114 | + |
| 115 | +### `readHumidity()` |
| 116 | + |
| 117 | +Read the humidity sensor's value. |
| 118 | + |
| 119 | +#### Syntax |
| 120 | + |
| 121 | +``` |
| 122 | +ENV.readHumidity() |
| 123 | +``` |
| 124 | + |
| 125 | +#### Parameters |
| 126 | + |
| 127 | +None. |
| 128 | + |
| 129 | +#### Returns |
| 130 | + |
| 131 | +The temperature sensor’s humidity value as a percentage. |
| 132 | + |
| 133 | +#### Example |
| 134 | + |
| 135 | +``` |
| 136 | +Serial.print("Humidity = "); |
| 137 | +Serial.print(ENV.readHumidity()); |
| 138 | +Serial.println(" %"); |
| 139 | +``` |
| 140 | + |
| 141 | +#### See also |
| 142 | + |
| 143 | +* [begin()](#begin) |
| 144 | +* [end()](#end) |
| 145 | +* [readTemperature()](#readTemperature) |
| 146 | +* [readPressure()](#readPressure) |
| 147 | +* [readIlluminance()](#readIlluminance) |
| 148 | +* [readUVA()](#readUVA) |
| 149 | +* [readUVB()](#readUVB) |
| 150 | +* [readUVIndex()](#readUVIndex) |
| 151 | + |
| 152 | +### `readPressure()` |
| 153 | + |
| 154 | +Read the pressure sensor's value. If no unit is specified, the value will be expressed in kilopascal. |
| 155 | + |
| 156 | +#### Syntax |
| 157 | + |
| 158 | +``` |
| 159 | +ENV.readPressure(unit) |
| 160 | +``` |
| 161 | + |
| 162 | +#### Parameters |
| 163 | + |
| 164 | +* _unit_: PSI to get the pressure in pound per square, MILLIBAR to get the pressure in millibar and KILOPASCAL to get the pressure in kilopascal (default). |
| 165 | + |
| 166 | +#### Returns |
| 167 | + |
| 168 | +The sensor’s pressure value as float in the specified unit. |
| 169 | + |
| 170 | +#### Example |
| 171 | + |
| 172 | +``` |
| 173 | +Serial.print("Pressure = "); |
| 174 | +Serial.print(ENV.readPressure()); |
| 175 | +Serial.println(" kPa"); |
| 176 | +``` |
| 177 | + |
| 178 | +#### See also |
| 179 | + |
| 180 | +* [begin()](#begin) |
| 181 | +* [end()](#end) |
| 182 | +* [readTemperature()](#readTemperature) |
| 183 | +* [readHumidity()](#readHumidity) |
| 184 | +* [readIlluminance()](#readIlluminance) |
| 185 | +* [readUVA()](#readUVA) |
| 186 | +* [readUVB()](#readUVB) |
| 187 | +* [readUVIndex()](#readUVIndex) |
| 188 | + |
| 189 | +### `readIlluminance()` |
| 190 | + |
| 191 | +Read the light sensor’s value. |
| 192 | + |
| 193 | +#### Syntax |
| 194 | + |
| 195 | +``` |
| 196 | +ENV.readIlluminance(unit) |
| 197 | +``` |
| 198 | + |
| 199 | +#### Parameters |
| 200 | + |
| 201 | +* _unit_: FOOTCANDLE to get the light value in footcandle, METERCANDLE to get the light in metercandle and LUX to get the light value in lux (default). |
| 202 | + |
| 203 | +#### Returns |
| 204 | + |
| 205 | +The light sensor's value as float in the specified unit. |
| 206 | + |
| 207 | +#### Example |
| 208 | + |
| 209 | +``` |
| 210 | +Serial.print("Lux = "); |
| 211 | +Serial.println(ENV.readIlluminance()); |
| 212 | +``` |
| 213 | + |
| 214 | +#### See also |
| 215 | + |
| 216 | +* [begin()](#begin) |
| 217 | +* [end()](#end) |
| 218 | +* [readTemperature()](#readTemperature) |
| 219 | +* [readHumidity()](#readHumidity) |
| 220 | +* [readPressure()](#readPressure) |
| 221 | +* [readUVA()](#readUVA) |
| 222 | +* [readUVB()](#readUVB) |
| 223 | +* [readUVIndex()](#readUVIndex) |
| 224 | + |
| 225 | +### `readUVA()` |
| 226 | + |
| 227 | +Read the UV sensor’s UV A value. |
| 228 | + |
| 229 | +#### Syntax |
| 230 | + |
| 231 | +``` |
| 232 | +ENV.readUVA() |
| 233 | +``` |
| 234 | + |
| 235 | +#### Parameters |
| 236 | + |
| 237 | +None. |
| 238 | + |
| 239 | +#### Returns |
| 240 | + |
| 241 | +The UV sensor's UV A value. |
| 242 | + |
| 243 | +#### Example |
| 244 | + |
| 245 | +``` |
| 246 | +Serial.print("UVA = "); |
| 247 | +Serial.println(ENV.readUVA()); |
| 248 | +``` |
| 249 | + |
| 250 | +#### See also |
| 251 | + |
| 252 | +* [begin()](#begin) |
| 253 | +* [end()](#end) |
| 254 | +* [readTemperature()](#readTemperature) |
| 255 | +* [readHumidity()](#readHumidity) |
| 256 | +* [readPressure()](#readPressure) |
| 257 | +* [readIlluminance()](#readIlluminance) |
| 258 | +* [readUVB()](#readUVB) |
| 259 | +* [readUVIndex()](#readUVIndex) |
| 260 | + |
| 261 | +### `readUVB()` |
| 262 | + |
| 263 | +Read the UV sensor’s UV B value. |
| 264 | + |
| 265 | +#### Syntax |
| 266 | + |
| 267 | +``` |
| 268 | +ENV.readUVB() |
| 269 | +``` |
| 270 | + |
| 271 | +#### Parameters |
| 272 | + |
| 273 | +None. |
| 274 | + |
| 275 | +#### Returns |
| 276 | + |
| 277 | +The UV sensor's UV B value. |
| 278 | + |
| 279 | +#### Example |
| 280 | + |
| 281 | +``` |
| 282 | +Serial.print("UVB = "); |
| 283 | +Serial.println(ENV.readUVB()); |
| 284 | +``` |
| 285 | + |
| 286 | +#### See also |
| 287 | + |
| 288 | +* [begin()](#begin) |
| 289 | +* [end()](#end) |
| 290 | +* [readTemperature()](#readTemperature) |
| 291 | +* [readHumidity()](#readHumidity) |
| 292 | +* [readPressure()](#readPressure) |
| 293 | +* [readIlluminance()](#readIlluminance) |
| 294 | +* [readUVA()](#readUVA) |
| 295 | +* [readUVIndex()](#readUVIndex) |
| 296 | + |
| 297 | +### `readUVIndex()` |
| 298 | + |
| 299 | +Read the UV sensor’s UV index value. |
| 300 | + |
| 301 | +#### Syntax |
| 302 | + |
| 303 | +``` |
| 304 | +ENV.readUVIndex() |
| 305 | +``` |
| 306 | + |
| 307 | +#### Parameters |
| 308 | + |
| 309 | +None. |
| 310 | + |
| 311 | +#### Returns |
| 312 | + |
| 313 | +The UV sensor’s UV index value. |
| 314 | + |
| 315 | +#### Example |
| 316 | + |
| 317 | +``` |
| 318 | +Serial.print("UV Index = "); |
| 319 | +Serial.println(ENV.readUVIndex()); |
| 320 | +``` |
| 321 | + |
| 322 | +#### See also |
| 323 | + |
| 324 | +* [begin()](#begin) |
| 325 | +* [end()](#end) |
| 326 | +* [readTemperature()](#readTemperature) |
| 327 | +* [readHumidity()](#readHumidity) |
| 328 | +* [readPressure()](#readPressure) |
| 329 | +* [readIlluminance()](#readIlluminance) |
| 330 | +* [readUVA()](#readUVA) |
| 331 | +* [readUVB()](#readUVB) |
0 commit comments