{"id":20989839,"url":"https://github.com/robtillaart/sht2x","last_synced_at":"2026-01-21T10:12:35.995Z","repository":{"id":37267980,"uuid":"410303039","full_name":"RobTillaart/SHT2x","owner":"RobTillaart","description":"Arduino library for the SHT2x series temperature and humidity sensors including SHT20, 21, 25.","archived":false,"fork":false,"pushed_at":"2026-01-20T21:47:32.000Z","size":97,"stargazers_count":25,"open_issues_count":2,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-01-21T04:36:10.190Z","etag":null,"topics":["arduino-library","humidity","temperature"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RobTillaart.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"RobTillaart","custom":"https://www.paypal.me/robtillaart"}},"created_at":"2021-09-25T15:05:58.000Z","updated_at":"2026-01-12T10:06:14.000Z","dependencies_parsed_at":"2024-04-13T10:27:26.905Z","dependency_job_id":"8d2c5d86-eb15-494d-8e49-a836195fbe08","html_url":"https://github.com/RobTillaart/SHT2x","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/RobTillaart/SHT2x","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FSHT2x","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FSHT2x/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FSHT2x/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FSHT2x/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RobTillaart","download_url":"https://codeload.github.com/RobTillaart/SHT2x/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FSHT2x/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28631936,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino-library","humidity","temperature"],"created_at":"2024-11-19T06:26:22.436Z","updated_at":"2026-01-21T10:12:35.988Z","avatar_url":"https://github.com/RobTillaart.png","language":"C++","funding_links":["https://github.com/sponsors/RobTillaart","https://www.paypal.me/robtillaart"],"categories":[],"sub_categories":[],"readme":"\n[![Arduino CI](https://github.com/RobTillaart/SHT2x/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)\n[![Arduino-lint](https://github.com/RobTillaart/SHT2x/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/SHT2x/actions/workflows/arduino-lint.yml)\n[![JSON check](https://github.com/RobTillaart/SHT2x/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/SHT2x/actions/workflows/jsoncheck.yml)\n[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/SHT2x.svg)](https://github.com/RobTillaart/SHT2x/issues)\n\n[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/SHT2x/blob/master/LICENSE)\n[![GitHub release](https://img.shields.io/github/release/RobTillaart/SHT2x.svg?maxAge=3600)](https://github.com/RobTillaart/SHT2x/releases)\n[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/SHT2x.svg)](https://registry.platformio.org/libraries/robtillaart/SHT2x)\n\n\n# SHT2x\n\nArduino library for the SHT2x, HTU2x and Si70xx temperature and humidity sensors.\n\n\n## Description\n\nThis library is not tested extensively yet.\nIt works for the Si7021 including the asynchronous interface.\nIt should work for SHT20, SHT21 and SHT25 but these are not tested yet.\nThe SHT2x family of sensors should work up to 400 KHz I2C.\n\nFurthermore there are several other sensors that should be compatible\n(see table below), but have not been tested either.\n\nAccuracy table\n\n|  Sensor   | Temperature | Humidity |  Notes  |\n|:---------:|:-----------:|:--------:|:--------|\n|  SHT20    |   ~0.3      |  ±3.0    |         |\n|  SHT21    |   ~0.3      |  ±3.0    |         |\n|  SHT25    |   ~0.3      |  ±1.8    |         |\n|  HTU20    |             |          |  to-do  |\n|  HTU21    |             |          |  #40    |\n|  Si7013   |             |          |  to-do  |\n|  Si7020   |             |          |  to-do  |\n|  Si7021   |   ~0.3      |  ~2.0    |         |\n|  GY21     |             |          |  to-do  |\n\n\nAll sensors in this family of sensors have address 0x40 (64 decimal).\nIf you want to use more on one I2C bus one needs either an I2C multiplexer\nor one should switch sensors on/off like the select in SPI communication.\n\nFeedback as always is welcome.\n\n\n### 0.5.0 Breaking change\n\nVersion 0.5.0 introduced a breaking change.\nYou cannot set the pins in **begin()** any more.\nThis reduces the dependency of processor dependent Wire implementations.\nThe user has to call **Wire.begin()** and can optionally set the Wire pins \nbefore calling **begin()**.\n\n\n### Related\n\n- https://github.com/RobTillaart/SHT31\n- https://github.com/RobTillaart/SHT85\n- https://github.com/RobTillaart/tinySHT2x\n- https://github.com/RobTillaart/Temperature Temperature related formulas.\n\n\n## Interface\n\n```cpp\n#include \"SHT2x.h\"\n```\n\nThe SHT2x library provides a comprehensive interface for interacting \nwith SHT2x, HTU2x, and Si70xx series temperature and humidity sensors.\n\n### Constructors\n\nThese constructors initialize a sensor object. All specific sensor classes \n(SHT20, Si7021, etc.) are derived from the base `SHT2x` class.\n\n- **SHT2x(TwoWire \\*wire = \u0026Wire)**: Base class constructor. \nOptionally takes a pointer to a `TwoWire` interface, allowing usage with \nmultiple I2C buses on platforms that support it.\n- **SHT20(TwoWire \\*wire = \u0026Wire)**: Constructor for SHT20 sensors.\n- **SHT21(TwoWire \\*wire = \u0026Wire)**: Constructor for SHT21 sensors.\n- **SHT25(TwoWire \\*wire = \u0026Wire)**: Constructor for SHT25 sensors.\n- **HTU20(TwoWire \\*wire = \u0026Wire)**: Constructor for HTU20 sensors.\n- **HTU21(TwoWire \\*wire = \u0026Wire)**: Constructor for HTU21 sensors.\n- **Si7013(TwoWire \\*wire = \u0026Wire)**: Constructor for Si7013 sensors.\n- **Si7020(TwoWire \\*wire = \u0026Wire)**: Constructor for Si7020 sensors.\n- **Si7021(TwoWire \\*wire = \u0026Wire)**: Constructor for Si7021 sensors.\n- **GY21(TwoWire \\*wire = \u0026Wire)**: Constructor for GY21 sensor modules \n(often using SHT2x compatible sensors).\n\n\n### Core/Basic Functions\n\nThese functions provide fundamental control and status information for the sensor.\n\n- **bool begin()**: Initializes the sensor. This function calls `reset()` \ninternally, which can take up to 15 ms. Returns `false` if the device address \nis not reachable or if the sensor fails to reset.\n- **bool isConnected()**: Checks if the sensor is reachable over the I2C bus. \nReturns `false` if the sensor is not connected or does not acknowledge.\n- **bool reset()**: Performs a soft reset of the sensor. This can take up to 15 ms. \nHard reset is not supported by this library.\n- **uint32_t lastRead()**: Returns the timestamp (in milliseconds since program start) \nof the last successful `read()` operation.\n- **uint8_t getStatus()**: Returns a 2-bit status code indicating the sensor's \ncurrent operational state. See the \"Status fields\" table for details on interpreting \nthese bits.\n\n\n### Temperature and Humidity (Synchronous Reading)\n\nThese functions are used for synchronous (blocking) reads of temperature and humidity.\n\n- **bool read()**: Reads both temperature and humidity from the sensor. \nThis is a blocking call; program execution will pause until the readings are complete.\n- **float getTemperature()**: Returns the temperature in degrees Celsius (°C) based \non the latest raw data acquired by `read()`.\n- **float getHumidity()**: Returns the relative humidity in percent (%) based on the \nlatest raw data acquired by `read()`.\n- **uint16_t getRawTemperature()**: Returns the raw, not calibrated 16-bit integer \nvalue for temperature directly from the sensor, as acquired by `read()`.\n- **uint16_t getRawHumidity()**: Returns the raw, not calibrated 16-bit integer \nvalue for humidity directly from the sensor, as acquired by `read()`.\n\n**Note on `read()` and data retrieval:**\nThe `getTemperature()` and `getHumidity()` functions recalculate values from raw \ndata on every call. If performance is critical, cache these values in your code after \na `read()` instead of calling them repeatedly. Raw values are useful for minimizing \nstorage or communication overhead.\n\nThe Si70xx sensors (Si7013, Si7020, Si7021) also support reading the temperature \nvalue that was internally measured during the last humidity acquisition. \nThis can be useful to get a temperature reading without initiating a new, \nseparate temperature measurement.\n- **bool readCachedTemperature()**: For Si70xx sensors, this function retrieves the \ntemperature value measured during the last humidity reading. This is available \nafter a `getHumidity()` call (using the synchronous `read()` method) or after \na `requestHumidity()` and successful `readHumidity()` (using the asynchronous interface). \nSee [pull request #27 comment](https://github.com/RobTillaart/SHT2x/pull/27#issuecomment-1836718214) \nfor more details on calling sequences.\n\n\n### Asynchronous Operations\n\nThe asynchronous interface allows you to initiate a temperature or humidity reading \nand then continue with other tasks while the sensor is performing the measurement. \nThis is useful for non-blocking applications, preventing your main loop from being \nstalled while waiting for sensor data. This interface is experimental (since 0.2.2) \nand may change in future versions. \nSee discussion in [issue #16](https://github.com/RobTillaart/SHT2x/issues/16).\n\n**General Workflow for Asynchronous Operations:**\n\n1.  **Initiate a request:** Call `requestTemperature()` to start a temperature \nmeasurement or `requestHumidity()` to start a humidity measurement. \nThe library sends the command to the sensor, which then begins its internal conversion process.\n2.  **Periodically check for data readiness:** In your main loop or a timed function, \ncall `reqTempReady()` (for temperature) or `reqHumReady()` (for humidity) to see if \nthe sensor has finished its measurement. These functions return `true` if data is available, \n`false` otherwise. `requestReady()` can be used to check if *any* requested data is ready.\n3.  **Read the value:** Once the corresponding \"ready\" function returns `true`, \ncall `readTemperature()` to retrieve the temperature value or `readHumidity()` to \nretrieve the humidity value. These functions then fetch the data from the sensor \nand update the internal raw values. \nYou can then use `getTemperature()` or `getHumidity()` to get the processed values.\n\n**Difference between synchronous `read()` and asynchronous operations:**\n- **Synchronous `read()`**: When you call `read()`, your program stops and waits \nfor the sensor to complete both temperature and humidity measurements. \nThis is simpler to use but can block other operations for the duration of the sensor's \nmeasurement time (which can be tens of milliseconds).\n- **Asynchronous functions**: You explicitly manage the measurement process. \nYou start a measurement, can perform other tasks, and then check back later to \nretrieve the result. \nThis avoids blocking but requires a slightly more complex program structure to \nperiodically check the sensor's status.\n\n**Asynchronous Function Descriptions:**\n\n- **`bool requestTemperature()`**: Initiates a request for a temperature reading from the sensor. \nIf a previous asynchronous request (either temperature or humidity) was still pending, \nit will be overridden by this new request. Returns `true` if the request command was \nsuccessfully sent to the sensor, `false` otherwise (e.g., I2C communication error).\n- **`bool requestHumidity()`**: Initiates a request for a humidity reading from the sensor. \nIf a previous asynchronous request was pending, it will be overridden. Returns `true` \nif the request command was successfully sent, `false` otherwise.\n- **`bool reqTempReady()`**: Checks if the temperature data previously requested by \n`requestTemperature()` is ready to be read from the sensor. Returns `true` if data is available, \n`false` if the measurement is still in progress or if no temperature request was made.\n- **`bool reqHumReady()`**: Checks if the humidity data previously requested by \n`requestHumidity()` is ready to be read. Returns `true` if data is available, `false` if the \nmeasurement is still in progress or if no humidity request was made.\n- **`bool requestReady()`**: Checks if *any* previously requested asynchronous data (either \ntemperature or humidity) is ready. This is useful if you don't need to distinguish which type \nof data is ready, only that some data can be read. Returns `true` if either temperature or \nhumidity data is available.\n- **`bool readTemperature()` (in asynchronous context)**: Reads the temperature data from the \nsensor *after* `requestTemperature()` has been called and `reqTempReady()` has returned `true`. \nThis function fetches the raw data from the sensor. After this call, `getTemperature()` and \n`getRawTemperature()` will return the newly acquired values. Returns `true` if the read was \nsuccessful, `false` otherwise (e.g., CRC error, I2C error).\n- **`bool readHumidity()` (in asynchronous context)**: Reads the humidity data from the sensor \n*after* `requestHumidity()` has been called and `reqHumReady()` has returned `true`. \nThis function fetches the raw data. After this call, `getHumidity()` and `getRawHumidity()` \nwill return the newly acquired values. Returns `true` if the read was successful, `false` otherwise.\n- **`uint32_t lastRequest()`**: Returns the timestamp (in milliseconds, based on `millis()`) \nof when the last asynchronous request (`requestTemperature()` or `requestHumidity()`) was made. \nThis can be useful for implementing timeouts for asynchronous operations.\n- **`uint8_t getRequestType()`**: Returns the type of the currently pending or last completed \nasynchronous request. This helps in determining what kind of data was requested or is ready. \nThe possible return values are:\n\n| Value  | Symbolic                |  Description  |\n|:------:|:------------------------|:--------------|\n| 0x00   | `SHT2x_REQ_NONE`        | No request pending or last request completed/cleared. |\n| 0x01   | `SHT2x_REQ_TEMPERATURE` | A temperature request is currently pending or was the last one made. |\n| 0x02   | `SHT2x_REQ_HUMIDITY`    | A humidity request is currently pending or was the last one made.    |\n| 0xFF   | `SHT2x_REQ_FAIL`        | A humidity request is currently pending or was the last one made.    |\n\n**Example Snippet (Asynchronous Reading):**\n\n```cpp\n#include \"SHT2x.h\"\n#include \"Wire.h\"\n\nSHT21 sht; // Or SHT20, SHT25, Si7021, etc.\n\nvoid setup() {\n  Serial.begin(115200);\n  Wire.begin();\n  if (!sht.begin()) {\n    Serial.println(\"SHT2x sensor not found!\");\n    while (1);\n  }\n  Serial.println(\"SHT2x sensor initialized.\");\n\n  // Request initial temperature reading\n  if (!sht.requestTemperature()) {\n    Serial.println(\"Failed to request temperature.\");\n  }\n}\n\nvoid loop() {\n  // Non-blocking check for temperature data\n  if (sht.getRequestType() == SHT2x_REQ_TEMPERATURE \u0026\u0026 sht.reqTempReady()) {\n    if (sht.readTemperature()) {\n      Serial.print(\"Temperature: \");\n      Serial.print(sht.getTemperature());\n      Serial.println(\" °C\");\n\n      // Now request humidity\n      if (!sht.requestHumidity()) {\n        Serial.println(\"Failed to request humidity.\");\n      }\n    } else {\n      Serial.println(\"Failed to read temperature.\");\n      // Optionally, re-request temperature or handle error\n      if (!sht.requestTemperature()) {\n        Serial.println(\"Failed to re-request temperature.\");\n      }\n    }\n  }\n\n  // Non-blocking check for humidity data\n  if (sht.getRequestType() == SHT2x_REQ_HUMIDITY \u0026\u0026 sht.reqHumReady()) {\n    if (sht.readHumidity()) {\n      Serial.print(\"Humidity: \");\n      Serial.print(sht.getHumidity());\n      Serial.println(\" %\");\n\n      // Now request temperature for the next cycle\n      if (!sht.requestTemperature()) {\n        Serial.println(\"Failed to request temperature for next cycle.\");\n      }\n    } else {\n      Serial.println(\"Failed to read humidity.\");\n      // Optionally, re-request humidity or handle error\n      if (!sht.requestHumidity()) {\n        Serial.println(\"Failed to re-request humidity.\");\n      }\n    }\n  }\n\n  // Do other non-blocking things in your loop here\n  // For example, yield() or delay(1) can be used if appropriate\n  // to prevent busy-waiting, depending on the platform.\n  // A simple delay to slow down serial output for this example:\n  delay(100); \n}\n```\n\n**Waiting until the device is ready:**\n\nThese sensors typically need a bit of time to start up before they can accept commands. \nThe SHT21, for instance, requires up to 15ms after it's been powered up. \nIn many programs, the delay that the Arduino framework introduces between your `setup()` \nand `loop()` functions is sufficient, but if you intend to request your first reading \nin `setup()` immediately after calling `begin()`, the request may fail. \nIf `requestTemperature()` or `requestHumidity()` returns false and the error code returned \nfrom `getError()` is `0x81` (`SHT2x_ERR_WRITECMD`), this may be a sign that the sensor isn't ready.\n\nTo work around this, introduce a short delay after calling `begin()` and before requesting a \nreading. 15ms is probably more than sufficient, although this hasn't been tested extensively.\n\n### Heater Functions\n\nThe built-in heater can be used to test the sensor or to drive off condensation.\n\n**WARNING:** Do not use the heater for long periods. The datasheet for SHT2x sensors does \nnot specify a maximum on-time, so the library conservatively uses the SHT3x series guideline:\nUse the heater for a maximum of **180 seconds** (3 minutes), then allow it to cool down \nfor at least **180 seconds**. The library enforces a cool-down period by preventing `heatOn()` \nfrom succeeding if called within 180 seconds of the last `heatOff()` call. \nThis guarding is not reboot persistent.\n**WARNING:** The user is responsible for switching the heater off manually using `heatOff()`. \nThe library does **NOT** do this automatically.\n\n- **void setHeatTimeout(uint8_t seconds)**: Sets the duration (in seconds) for the heater \nto be active when `heatOn()` is called. This value is capped at a maximum of 180 seconds.\n- **uint8_t getHeatTimeout()**: Returns the currently set heat timeout value in seconds.\n- **bool heatOn()**: Turns the internal heater on. Returns `false` if the heater cannot \nbe turned on (e.g., during the mandatory cool-down period or if I2C communication fails), \nsetting an error code (SHT2x_ERR_HEATER_COOLDOWN or SHT2x_ERR_HEATER_ON).\n- **bool heatOff()**: Turns the internal heater off. Returns `false` if the heater cannot \nbe switched off (e.g., I2C communication error), setting the SHT2x_ERR_HEATER_OFF error.\n- **bool isHeaterOn()**: Checks if the heater is currently active (i.e., within the \n`_heatTimeout` period since `heatOn()` was called and before `heatOff()` is called). \nCalling this function will also turn the heater off if the timeout has expired.\n- **bool setHeaterLevel(uint8_t level)**: Sets the heater power level. \nThe level is a value from 0 to 15. (Note: This function's availability might depend on the \nspecific sensor model; refer to the sensor datasheet.)\n- **bool getHeaterLevel(uint8_t \u0026level)**: Reads the current heater power level. \n(Note: Availability might depend on the specific sensor model.)\n\n\n### Electronic ID\n\nFunctions to retrieve the unique electronic identification code and firmware version from the sensor.\n(These functions need more testing and have primarily been tested with Si7021 sensors.)\n\n- **uint32_t getEIDA()**: Returns the first part (A) of the electronic ID.\n- **uint32_t getEIDB()**: Returns the second part (B) of the electronic ID.\n- **uint8_t getFirmwareVersion()**: Returns the firmware version of the sensor.\n\n\n### Resolution Control\n\nAllows adjustment of the measurement resolution for temperature and humidity.\n**Warning: This feature is experimental** (since 0.2.0) and requires more testing, \nas initial results are not perfectly aligned with datasheet specifications. \nIt has been primarily tested on HTUxx and Si7021 sensors using the `SHT2X_resolution.ino` example.\n\n- **bool setResolution(uint8_t res)**: Sets the measurement resolution. \n`res` can be 0, 1, 2, or 3. Other values will result in the function returning `false`.\n- **uint8_t getResolution()**: Returns the currently set resolution (cached value).\n\nDatasheet SHT20 Table 8: Resolution settings\n\n| RES | Humidity | Temperature |\n|:---:|:--------:|:-----------:|\n|  0  |  12 bit  |   14 bit    |\n|  1  |  08 bit  |   12 bit    |\n|  2  |  10 bit  |   13 bit    |\n|  3  |  11 bit  |   11 bit    |\n\nDatasheet SHT20 Table 7: Measurement timing (milliseconds) vs. observed real-world measurements.\n(See details at https://github.com/RobTillaart/SHT2x/pull/11)\n\n| RES | HUM (datasheet) | TEMP (datasheet) | TOTAL (datasheet) | REAL (observed) |\n|:---:|:---------------:|:----------------:|:-----------------:|:---------------:|\n|  0  |       29        |        85        |        114        |       116       |\n|  1  |        4        |        22        |         26        |       113       |\n|  2  |        9        |        43        |         52        |       084       |\n|  3  |       15        |        11        |         26        |       102       |\n\n\n### Battery Status\n\n- **bool batteryOK()**: Checks the sensor's battery status indicator. \nReturns `true` if VCC is above approximately 2.25V (threshold may vary slightly by sensor). \nNot all sensors support this feature.\n\n\n### Error Handling\n\n- **int getError()**: Returns the last error code set by a library function and then \nclears the internal error flag. It's important to call `getError()` to check for \nerrors after sensor operations, especially if a function returns `false`. \nCalling `getError()` before another operation ensures you are checking the result \nof the most recent operation.\n\nError Codes:\n| Value  | Symbolic                  | Description                       | Notes     |\n|:------:|:--------------------------|:----------------------------------|:----------|\n| 0x00   | SHT2x_OK                  | No error                          |           |\n| 0x81   | SHT2x_ERR_WRITECMD        | I2C write command failed          |           |\n| 0x82   | SHT2x_ERR_READBYTES       | I2C read bytes failed             |           |\n| 0x83   | SHT2x_ERR_HEATER_OFF      | Could not switch off heater       |           |\n| 0x84   | SHT2x_ERR_NOT_CONNECT     | Could not connect to sensor       |           |\n| 0x85   | SHT2x_ERR_CRC_TEMP        | CRC check failed for temperature  |           |\n| 0x86   | SHT2x_ERR_CRC_HUM         | CRC check failed for humidity     |           |\n| 0x87   | SHT2x_ERR_CRC_STATUS      | CRC check failed for status reg   | Not used  |\n| 0x88   | SHT2x_ERR_HEATER_COOLDOWN | Heater needs to cool down         |           |\n| 0x89   | SHT2x_ERR_HEATER_ON       | Could not switch on heater        | (Note: 0x88 was duplicated in original, assuming 0x89 for HEATER_ON based on .h) |\n| 0x8A   | SHT2x_ERR_RESOLUTION      | Invalid resolution setting        | Added in 0.2.0 |\n\nNote: HTU20 / HTU21 classes share these error codes. \nThe error SHT2x_ERR_HEATER_ON was listed with code 0x88 in the original README \nbut is 0x89 in SHT2x.h; this table uses 0x89.\n\n\n### Status fields\n\nThe `getStatus()` function returns a 2-bit value that indicates the type of measurement in the last user register read.\nFrom HTU20 datasheet (consult your specific sensor's datasheet for definitive details).\n\n| Bits | Value | Symbolic                    | Description         |\n|:----:|:-----:|:----------------------------|:--------------------|\n|  00  |   0   | SHT2x_STATUS_OPEN_CIRCUIT   | Open circuit        |\n|  01  |   1   | SHT2x_STATUS_TEMPERATURE    | Temperature reading |\n|  10  |   2   | SHT2x_STATUS_HUMIDITY       | Humidity reading    |\n|  11  |   3   | SHT2x_STATUS_CLOSED_CIRCUIT | Closed circuit      |\n\n\n## Interface HTU21\n\nAdditional functions for the **HTU21** as this is the only sensor that support this\nas far as known. Note: the HTU21 is also found on some GY21 batches.\n\n\n### Temperature compensated humidity\n\nSee #40 for some details.\n\n  //  Returns temperature compensated humidity (internal or external temp sensor.\n- **float getHumidityCompensated()** Returns temperature compensated humidity based upon\nthe internal temperature (degrees C). \nNote both must be read first.\n- **float getHumidityCompensated(float temperature)** Returns temperature compensated \nhumidity based upon an external temperature (degrees C).\n- **void setHumidityCompensationFactor(float hcFactor = -0.15f)** adjust the humidity\ncompensation factor (in %/°C), default -0.15.\n- **float getHumidityCompensationFactor()** returns the set value, default -0.15f.\n\n\n## Future\n\n#### Must\n\n- improve documentation\n  - reorganize interface\n  - async documentation\n- clean up code.\n\n#### Should\n\n- test test test\n  - get hardware\n- add examples\n  - test resolutions\n  - performance different resolutions\n  - test battery\n\n#### Could\n\n- update unit tests\n- add type info in derived classes?\n\n#### Wont\n\n- add **getSerialNumber()**\n  **getEIDA()** and **getEIDB()** covers this\n\n\n## Support\n\nIf you appreciate my libraries, you can support the development and maintenance.\nImprove the quality of the libraries by providing issues and Pull Requests, or\ndonate through PayPal or GitHub sponsors.\n\nThank you,\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtillaart%2Fsht2x","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobtillaart%2Fsht2x","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtillaart%2Fsht2x/lists"}