mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-09-19 16:46:11 -04:00
0.4.1 SHT2X
This commit is contained in:
parent
7a54362066
commit
675e9eb012
@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|||||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
|
||||||
|
## [0.4.1] - 2023-11-25
|
||||||
|
- fix **reset()**: clear state of resolution, heater and error
|
||||||
|
- update readme.md
|
||||||
|
- minor edits
|
||||||
|
|
||||||
## [0.4.0] - 2023-09-21
|
## [0.4.0] - 2023-09-21
|
||||||
- moved TwoWire param from begin() to Constructor
|
- moved TwoWire param from begin() to Constructor
|
||||||
- FIx #23 support for Wire1 for ESP32
|
- FIx #23 support for Wire1 for ESP32
|
||||||
|
@ -26,9 +26,9 @@ Accuracy table
|
|||||||
|
|
||||||
| Sensor | Temperature | Humidity | Notes |
|
| Sensor | Temperature | Humidity | Notes |
|
||||||
|:---------:|:-----------:|:--------:|:--------|
|
|:---------:|:-----------:|:--------:|:--------|
|
||||||
| SHT20 | ~0.3 | ±3.0 | |
|
| SHT20 | ~0.3 | ±3.0 | |
|
||||||
| SHT21 | ~0.3 | ±3.0 | |
|
| SHT21 | ~0.3 | ±3.0 | |
|
||||||
| SHT25 | ~0.3 | ±1.8 | |
|
| SHT25 | ~0.3 | ±1.8 | |
|
||||||
| HTU20 | | | to-do |
|
| HTU20 | | | to-do |
|
||||||
| HTU21 | | | to-do |
|
| HTU21 | | | to-do |
|
||||||
| Si7013 | | | to-do |
|
| Si7013 | | | to-do |
|
||||||
@ -83,7 +83,7 @@ Initial release has a blocking delay.
|
|||||||
- **uint32_t lastRead()** in milliSeconds since start of program.
|
- **uint32_t lastRead()** in milliSeconds since start of program.
|
||||||
- **bool reset()** resets the sensor, soft reset, no hard reset supported.
|
- **bool reset()** resets the sensor, soft reset, no hard reset supported.
|
||||||
- **float getHumidity()** computes the relative humidity in % based off the latest raw reading, and returns it.
|
- **float getHumidity()** computes the relative humidity in % based off the latest raw reading, and returns it.
|
||||||
- **float getTemperature()** computes the temperature in °C based off the latest raw reading, and returns it.
|
- **float getTemperature()** computes the temperature in °C based off the latest raw reading, and returns it.
|
||||||
- **uint16_t getRawHumidity()** returns the raw two-byte representation of humidity directly from the sensor.
|
- **uint16_t getRawHumidity()** returns the raw two-byte representation of humidity directly from the sensor.
|
||||||
- **uint16_t getRawTemperature()** returns the raw two-byte representation of temperature directly from the sensor.
|
- **uint16_t getRawTemperature()** returns the raw two-byte representation of temperature directly from the sensor.
|
||||||
|
|
||||||
@ -244,6 +244,9 @@ Timing in milliseconds.
|
|||||||
- investigate blocking delay() in read
|
- investigate blocking delay() in read
|
||||||
- add offset for temperature and humidity
|
- add offset for temperature and humidity
|
||||||
|
|
||||||
|
#### 0.4.1
|
||||||
|
- fix reset(): clear state of resolution, heater and error
|
||||||
|
|
||||||
#### Should
|
#### Should
|
||||||
|
|
||||||
- test test test
|
- test test test
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
//
|
//
|
||||||
// FILE: SHT2x.cpp
|
// FILE: SHT2x.cpp
|
||||||
// AUTHOR: Rob Tillaart, Viktor Balint
|
// AUTHOR: Rob Tillaart, Viktor Balint, JensB
|
||||||
// VERSION: 0.4.0
|
// VERSION: 0.4.1
|
||||||
// DATE: 2021-09-25
|
// DATE: 2023-11-25
|
||||||
// PURPOSE: Arduino library for the SHT2x temperature and humidity sensor
|
// PURPOSE: Arduino library for the SHT2x temperature and humidity sensor
|
||||||
// URL: https://github.com/RobTillaart/SHT2x
|
// URL: https://github.com/RobTillaart/SHT2x
|
||||||
|
|
||||||
@ -11,20 +11,20 @@
|
|||||||
|
|
||||||
|
|
||||||
// SUPPORTED COMMANDS
|
// SUPPORTED COMMANDS
|
||||||
#define SHT2x_GET_TEMPERATURE_NO_HOLD 0xF3
|
#define SHT2x_GET_TEMPERATURE_NO_HOLD 0xF3
|
||||||
#define SHT2x_GET_HUMIDITY_NO_HOLD 0xF5
|
#define SHT2x_GET_HUMIDITY_NO_HOLD 0xF5
|
||||||
#define SHT2x_SOFT_RESET 0xFE
|
#define SHT2x_SOFT_RESET 0xFE
|
||||||
#define SHT2x_WRITE_USER_REGISTER 0xE6
|
#define SHT2x_WRITE_USER_REGISTER 0xE6
|
||||||
#define SHT2x_READ_USER_REGISTER 0xE7
|
#define SHT2x_READ_USER_REGISTER 0xE7
|
||||||
|
|
||||||
#define SHT2x_HEATER_TIMEOUT 180000UL // milliseconds
|
#define SHT2x_HEATER_TIMEOUT 180000UL // milliseconds
|
||||||
|
|
||||||
#define SHT2x_ADDRESS 0x40
|
#define SHT2x_ADDRESS 0x40
|
||||||
|
|
||||||
|
|
||||||
#define SHT2x_USRREG_RESOLUTION 0x81
|
#define SHT2x_USRREG_RESOLUTION 0x81
|
||||||
#define SHT2x_USRREG_BATTERY 0x20
|
#define SHT2x_USRREG_BATTERY 0x20
|
||||||
#define SHT2x_USRREG_HEATER 0x04
|
#define SHT2x_USRREG_HEATER 0x04
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
@ -273,8 +273,14 @@ uint16_t SHT2x::getRawHumidity()
|
|||||||
|
|
||||||
bool SHT2x::reset()
|
bool SHT2x::reset()
|
||||||
{
|
{
|
||||||
bool b = writeCmd(SHT2x_SOFT_RESET);
|
bool success = writeCmd(SHT2x_SOFT_RESET);
|
||||||
return b;
|
if (success)
|
||||||
|
{
|
||||||
|
_resolution = 0;
|
||||||
|
_heaterOn = false;
|
||||||
|
_error = SHT2x_OK;
|
||||||
|
}
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
//
|
//
|
||||||
// FILE: SHT2x.h
|
// FILE: SHT2x.h
|
||||||
// AUTHOR: Rob Tillaart, Viktor Balint
|
// AUTHOR: Rob Tillaart, Viktor Balint, JensB
|
||||||
// VERSION: 0.4.0
|
// VERSION: 0.4.1
|
||||||
// DATE: 2021-09-25
|
// DATE: 2023-11-25
|
||||||
// PURPOSE: Arduino library for the SHT2x temperature and humidity sensor
|
// PURPOSE: Arduino library for the SHT2x temperature and humidity sensor
|
||||||
// URL: https://github.com/RobTillaart/SHT2x
|
// URL: https://github.com/RobTillaart/SHT2x
|
||||||
//
|
//
|
||||||
@ -13,7 +13,7 @@
|
|||||||
#include "Wire.h"
|
#include "Wire.h"
|
||||||
|
|
||||||
|
|
||||||
#define SHT2x_LIB_VERSION (F("0.4.0"))
|
#define SHT2x_LIB_VERSION (F("0.4.1"))
|
||||||
|
|
||||||
|
|
||||||
// fields getStatus
|
// fields getStatus
|
||||||
@ -63,7 +63,7 @@ public:
|
|||||||
//
|
//
|
||||||
// TEMPERATURE AND HUMIDTY
|
// TEMPERATURE AND HUMIDTY
|
||||||
//
|
//
|
||||||
// read must be called get getTemperature / getHumidity
|
// read must be called before calling getTemperature / getHumidity
|
||||||
bool read();
|
bool read();
|
||||||
|
|
||||||
float getTemperature();
|
float getTemperature();
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Viktor Balint"
|
"name": "Viktor Balint"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "JensB"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"repository":
|
"repository":
|
||||||
@ -18,7 +21,7 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/RobTillaart/SHT2x.git"
|
"url": "https://github.com/RobTillaart/SHT2x.git"
|
||||||
},
|
},
|
||||||
"version": "0.4.0",
|
"version": "0.4.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"frameworks": "*",
|
"frameworks": "*",
|
||||||
"platforms": "*",
|
"platforms": "*",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=SHT2x
|
name=SHT2x
|
||||||
version=0.4.0
|
version=0.4.1
|
||||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
sentence=Arduino library for the I2C SHT20 SHT21 SHT25 series temperature and humidity sensor.
|
sentence=Arduino library for the I2C SHT20 SHT21 SHT25 series temperature and humidity sensor.
|
||||||
|
Loading…
Reference in New Issue
Block a user