Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
331 changes: 331 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,331 @@
# Arduino MKR ENV library

## Methods

### `begin()`

Initialize the sensors on the shield.

#### Syntax

```
ENV.begin()
```

#### Parameters

None.

#### Returns

1 on success, 0 on failure.

#### Example

```
if (!ENV.begin()) {
Serial.println("Failed to initialize MKR ENV shield!");
while (1);
}
```

#### See also

* [end()](#end)
* [readTemperature()](#readTemperature)
* [readHumidity()](#readHumidity)
* [readPressure()](#readPressure)
* [readIlluminance()](#readIlluminance)
* [readUVA()](#readUVA)
* [readUVB()](#readUVB)
* [readUVIndex()](#readUVIndex)

### `end()`

De-initialize the sensors on the shield.

#### Syntax

```
ENV.end()
```

#### Parameters

None.

#### Returns

None.

#### Example

```
ENV.end();
```

#### See also

* [begin()](#begin)
* [readTemperature()](#readTemperature)
* [readHumidity()](#readHumidity)
* [readPressure()](#readPressure)
* [readIlluminance()](#readIlluminance)
* [readUVA()](#readUVA)
* [readUVB()](#readUVB)
* [readUVIndex()](#readUVIndex)

### `readTemperature()`

Read the temperature sensor's value. If no unit is specified as parameter, the value will be expressed in Celsius.

#### Syntax

```
ENV.readTemperature(unit)
```

#### Parameters

* _unit_: FAHRENHEIT to get the temperature in Fahrenheit and CELSIUS to get the temperature in Celsius (default).

#### Returns

The sensor’s temperature value as float in the specified unit.

#### Example

```
Serial.print("Temperature = ");
Serial.print(ENV.readTemperature());
Serial.println(" °C");
```

#### See also

* [begin()](#begin)
* [end()](#end)
* [readHumidity()](#readHumidity)
* [readPressure()](#readPressure)
* [readIlluminance()](#readIlluminance)
* [readUVA()](#readUVA)
* [readUVB()](#readUVB)
* [readUVIndex()](#readUVIndex)

### `readHumidity()`

Read the humidity sensor's value.

#### Syntax

```
ENV.readHumidity()
```

#### Parameters

None.

#### Returns

The temperature sensor’s humidity value as a percentage.

#### Example

```
Serial.print("Humidity = ");
Serial.print(ENV.readHumidity());
Serial.println(" %");
```

#### See also

* [begin()](#begin)
* [end()](#end)
* [readTemperature()](#readTemperature)
* [readPressure()](#readPressure)
* [readIlluminance()](#readIlluminance)
* [readUVA()](#readUVA)
* [readUVB()](#readUVB)
* [readUVIndex()](#readUVIndex)

### `readPressure()`

Read the pressure sensor's value. If no unit is specified, the value will be expressed in kilopascal.

#### Syntax

```
ENV.readPressure(unit)
```

#### Parameters

* _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).

#### Returns

The sensor’s pressure value as float in the specified unit.

#### Example

```
Serial.print("Pressure = ");
Serial.print(ENV.readPressure());
Serial.println(" kPa");
```

#### See also

* [begin()](#begin)
* [end()](#end)
* [readTemperature()](#readTemperature)
* [readHumidity()](#readHumidity)
* [readIlluminance()](#readIlluminance)
* [readUVA()](#readUVA)
* [readUVB()](#readUVB)
* [readUVIndex()](#readUVIndex)

### `readIlluminance()`

Read the light sensor’s value.

#### Syntax

```
ENV.readIlluminance(unit)
```

#### Parameters

* _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).

#### Returns

The light sensor's value as float in the specified unit.

#### Example

```
Serial.print("Lux = ");
Serial.println(ENV.readIlluminance());
```

#### See also

* [begin()](#begin)
* [end()](#end)
* [readTemperature()](#readTemperature)
* [readHumidity()](#readHumidity)
* [readPressure()](#readPressure)
* [readUVA()](#readUVA)
* [readUVB()](#readUVB)
* [readUVIndex()](#readUVIndex)

### `readUVA()`

Read the UV sensor’s UV A value.

#### Syntax

```
ENV.readUVA()
```

#### Parameters

None.

#### Returns

The UV sensor's UV A value.

#### Example

```
Serial.print("UVA = ");
Serial.println(ENV.readUVA());
```

#### See also

* [begin()](#begin)
* [end()](#end)
* [readTemperature()](#readTemperature)
* [readHumidity()](#readHumidity)
* [readPressure()](#readPressure)
* [readIlluminance()](#readIlluminance)
* [readUVB()](#readUVB)
* [readUVIndex()](#readUVIndex)

### `readUVB()`

Read the UV sensor’s UV B value.

#### Syntax

```
ENV.readUVB()
```

#### Parameters

None.

#### Returns

The UV sensor's UV B value.

#### Example

```
Serial.print("UVB = ");
Serial.println(ENV.readUVB());
```

#### See also

* [begin()](#begin)
* [end()](#end)
* [readTemperature()](#readTemperature)
* [readHumidity()](#readHumidity)
* [readPressure()](#readPressure)
* [readIlluminance()](#readIlluminance)
* [readUVA()](#readUVA)
* [readUVIndex()](#readUVIndex)

### `readUVIndex()`

Read the UV sensor’s UV index value.

#### Syntax

```
ENV.readUVIndex()
```

#### Parameters

None.

#### Returns

The UV sensor’s UV index value.

#### Example

```
Serial.print("UV Index = ");
Serial.println(ENV.readUVIndex());
```

#### See also

* [begin()](#begin)
* [end()](#end)
* [readTemperature()](#readTemperature)
* [readHumidity()](#readHumidity)
* [readPressure()](#readPressure)
* [readIlluminance()](#readIlluminance)
* [readUVA()](#readUVA)
* [readUVB()](#readUVB)
21 changes: 21 additions & 0 deletions docs/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Arduino MKR ENV library

The Arduino MKR ENV library allows you to read the sensors on the MKR ENV Shield. It manages the different interfaces used by the sensors on the shield to give you an uniform and simple set of functions to read them. The library takes care of the calculations needed to produce values in the requested units. The values returned are signed floats.

To use this library:

```
#include <Arduino_MKRENV.h>
```

The Arduino MKR ENV library takes care of the sensor initialization and sets its values as follows:

- Absolute pressure range: 260 to 1260 hPa.
- Humidity range: 0 to 100%
- Humidity accuracy: ± 3.5% rH, 20 to +80% rH.
- Temperature range -40 to 120 °C.
- Temperature accuracy: ± 0.5 °C from 15 to 40 °C.
- Lux range: 10 to 100,000 lux.
- UVA/UVB resolution: 16-bit; unit μW/cm2.
- UVIndex: 1 to 11+.