From b8e8824f9b7482d318ba8cc79c95e78caebbbaab Mon Sep 17 00:00:00 2001 From: canchebagur Date: Fri, 25 Jun 2021 21:05:09 -0600 Subject: [PATCH 1/2] Add docs folder. --- docs/api.md | 163 +++++++++++++++++++++++++++++++++++++++++++++++++ docs/readme.md | 17 ++++++ 2 files changed, 180 insertions(+) create mode 100644 docs/api.md create mode 100644 docs/readme.md diff --git a/docs/api.md b/docs/api.md new file mode 100644 index 0000000..3fef795 --- /dev/null +++ b/docs/api.md @@ -0,0 +1,163 @@ +# ArduinoHTS221 library + +## Methods + +### `begin()` + +Initialize the humidity and temperature sensor. + +#### Syntax + +``` +HTS.begin() +``` + +#### Parameters + +None. + +#### Returns + +1 on success, 0 on failure. + +#### Example + +``` +if (!HTS.begin()) { + Serial.println("Failed to initialize humidity temperature sensor!"); + while (1); +} +``` + +#### See also + +* [end()](#end) +* [readTemperature()](#readTemperature) +* [readHumidity()](#readHumidity) + +### `end()` + +De-initialize the humidity and temperature sensor. + +#### Syntax + +``` +HTS.end() +``` + +#### Parameters + +None. + +#### Returns + +None. + +#### Example + +``` +if (!HTS.begin()) { + Serial.println("Failed to initialize humidity temperature sensor!"); + while (1); +} + +// ... + +HTS.end(); +``` + +#### See also + +* [begin()](#begin) +* [readTemperature()](#readTemperature) +* [readHumidity()](#readHumidity) + +### `readTemperature()` + +Read the sensor’s measured temperature value. + +#### Syntax + +``` +HTS.readTemperature() +HTS.readTemperature(units) +``` + +#### Parameters + +* _units_: FAHRENHEIT to read the temperature in Fahrenheit and CELSIUS to read the temperature in Celsius. If unit parameter is not provided, default is CELSIUS. + +#### Returns + +The temperature in degrees Farenheit or Celsius, depending on the units requested. + +#### Example + +``` +float temperature = HTS.readTemperature(); + +Serial.print("Temperature = "); +Serial.print(temperature); +Serial.println(" °C"); +``` + +#### See also + +* [begin()](#begin) +* [end()](#end) +* [readHumidity()](#readHumidity) + +### `readHumidity()` + +Read the sensor’s measured relative humidity value. + +#### Syntax + +``` +HTS.readHumidity() +``` + +#### Parameters + +None. + +#### Returns + +The humidity value from the sensor as a percentage. + +#### Example + +``` +float humidity = HTS.readHumidity(); + +Serial.print("Humidity = "); +Serial.print(humidity); +Serial.println(" %"); +``` + +#### See also + +* [begin()](#begin) +* [end()](#end) +* [readTemperature()](#readTemperature) + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/readme.md b/docs/readme.md new file mode 100644 index 0000000..070411e --- /dev/null +++ b/docs/readme.md @@ -0,0 +1,17 @@ +# ArduinoHTS221 library + + +The ArduinoHTS221 library allows you to use the HTS221 sensor available on the Arduino® Nano 33 BLE Sense board to read the temperature and the relative humidity of the environment. + +To use this library: + +``` +#include +``` + +Main features of the HTS221 sensor: + +- Humidity accuracy: ± 3.5% rH, 20 to +80% rH. +- Humidity range: 0 to 100%. +- Temperature accuracy: ± 0.5 °C, 15 to +40 °C. +- Temperature range: -40 to 120° C, From 6fb862c0668f91dd2dab98649412b58ffe3147e7 Mon Sep 17 00:00:00 2001 From: canchebagur Date: Fri, 25 Jun 2021 22:34:11 -0600 Subject: [PATCH 2/2] Update api.md --- docs/api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api.md b/docs/api.md index 3fef795..d27963d 100644 --- a/docs/api.md +++ b/docs/api.md @@ -89,7 +89,7 @@ HTS.readTemperature(units) #### Returns -The temperature in degrees Farenheit or Celsius, depending on the units requested. +The temperature in degrees Fahrenheit or Celsius, depending on the units requested. #### Example