SHT21 & SHT25 humidity and temperature sensors
Revision 1:f9e3348b41a2, committed 2018-04-27
- Comitter:
- johnathanlyu
- Date:
- Fri Apr 27 09:44:28 2018 +0000
- Parent:
- 0:f5f628a42ba8
- Commit message:
- update library initial flow
Changed in this revision
SHT2X.cpp | Show annotated file Show diff for this revision Revisions of this file |
SHT2X.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r f5f628a42ba8 -r f9e3348b41a2 SHT2X.cpp --- a/SHT2X.cpp Fri Jun 02 05:43:32 2017 +0000 +++ b/SHT2X.cpp Fri Apr 27 09:44:28 2018 +0000 @@ -1,6 +1,6 @@ #include "SHT2X.h" -SHT2X::SHT2X(I2C& i2c) : m_i2c(i2c), pc(p5,p4) { +SHT2X::SHT2X(I2C& i2c, Serial& pc) : m_i2c(i2c), m_pc(pc) { } int SHT2X::measureTemperature(float *tempC) { @@ -17,7 +17,7 @@ m_i2c.read(SHT_I2C_ADDR, rx, 3, false); temperature = (rx[0]<<8 | rx[1]); temperature += ~0x0003; -// pc.printf(" uint_temp %d \r\n", temperature); +// m_pc.printf(" uint_temp %d \r\n", temperature); *tempC = -46.85 + 175.72 * ( ((float) temperature) / 65536 ); return 0;
diff -r f5f628a42ba8 -r f9e3348b41a2 SHT2X.h --- a/SHT2X.h Fri Jun 02 05:43:32 2017 +0000 +++ b/SHT2X.h Fri Apr 27 09:44:28 2018 +0000 @@ -61,7 +61,7 @@ class SHT2X { public: - SHT2X(I2C& i2c); + SHT2X(I2C& i2c, Serial& pc); int readData(float *tempC, float *relHumidty); int measureTemperature(float *tempC); int measureHumidty(float *relHumidty); @@ -69,7 +69,7 @@ bool softRest(); protected: I2C m_i2c; - Serial pc; + Serial m_pc; private: };