diff --git a/docs/api.md b/docs/api.md new file mode 100644 index 0000000..c019094 --- /dev/null +++ b/docs/api.md @@ -0,0 +1,106 @@ +# ArduinoLPS22HB library + +## Methods + +### `begin()` + +Initialize the pressure sensor. + +#### Syntax + +``` +BARO.begin() +``` + +#### Parameters + +None. + +#### Returns + +1 on success, 0 on failure. + +#### Example + +``` +if (!BARO.begin()) { + Serial.println("Failed to initialize pressure sensor!"); + while (1); +} +``` + +#### See also + +* [end()](#end) +* [readPressure()](#readPressure) + +### `end()` + +De-initialize the pressure sensor. + +#### Syntax + +``` +BARO.end() +``` + +#### Parameters + +None. + +#### Returns + +None. + +#### Example + +``` +if (!BARO.begin()) { + Serial.println("Failed to initialize pressure sensor!"); + while (1); +} + +// ... + +BARO.end(); +``` + +#### See also + +* [begin()](#begin) +* [readPressure()](#readPressure) + +### `readPressure()` + +Read the sensor's measured pressure value. + + +#### Syntax + +``` +BARO.readPressure() +BARO.readPressure(units) +``` + +#### Parameters + +* _units_: `PSI` to read the pressure in PSI (pounds per square inch), `MILLIBAR` to read the pressure in millibars and `KILOPASCALS` to read the pressure in kilopascals. If unit parameter is not provided, default is kilopascals . + +#### Returns + +The pressure in PSI, millibar or kilopascal, depending on the units requested. + +#### Examples + +``` +float pressure = BARO.readPressure(); + +Serial.print("Pressure = "); +Serial.print(pressure); +Serial.println(" kPa"); +``` + +#### See also + +* [begin()](#begin) +* [end()](#end) \ No newline at end of file diff --git a/docs/readme.md b/docs/readme.md new file mode 100644 index 0000000..effc884 --- /dev/null +++ b/docs/readme.md @@ -0,0 +1,15 @@ +# ArduinoLPS22HB library + + +The ArduinoLPS22HB library allows you to use the LPS22HB sensor available on the Arduino® Nano 33 BLE Sense board to read the air pressure. + +To use this library: + +``` +#include +``` + +Main features of the HTS221 sensor: + +- Absolute pressure range: 260 to 1260 hPa. +