Playing With Fusion SHT3X Arduino Library
Loading...
Searching...
No Matches
Playing With Fusion SHT3X Library

Playing With Fusion, Inc. invests time and resources developing open-source code. Please support Playing With Fusion and continued open-source development by buying products from Playing With Fusion!

Compatible Products

Designed for use with with Playing With Fusion SHT31-DIS-B and SHT31-DIS-F Humidity and Temperature Sensor Breakouts: SEN-37002

SEN-37002 (universal applications) —> http://www.playingwithfusion.com/productview.php?pdid=81 B, no filter —> F, with filter Note: This will aslo work with other SHT3X sensors (SHT35, for instance)

Tested Platforms:

  • Arduino Uno R3
  • R3aktor M0 Logger

Minimal Example

Here is a minimal example you can use to get running using a R3aktor M0 logger:

#include "PWFusion_SHT3X.h"
// Static variables
static PWFusion_SHT3X sht3 = {};
void setup() {
// Setup Serial
Serial.begin(115200);
while (!Serial) {;}
Serial.println("Initialized serial");
// Setup SHT3X sensor (Playing With Fusion)
{
Serial.println("Failed to initialize temp/humidity sensor");
while (1) {;}
}
Serial.println("Initialization success");
}
void loop() {
// Measure sensor
if (!d.wasError())
{
Serial.print("Temp (F): ");
Serial.print(d.getTempF());
Serial.print(" Temp (C): ");
Serial.print(d.getTempC());
Serial.print(" Humidity (%): ");
Serial.println(d.getRelativeHumidity() * 100);
}
else
{
Serial.println("Error trying to get data");
}
delay(1000);
}
Playing With Fusion SEN-37002 (SHT3X) Arduino library.
#define SHT3X_ADDR_PRIMARY
Address to use for device if ADDR pin is tied to GND (solder jumper soldered)
Definition: PWFusion_SHT3X.h:121
Holds data from a transaction with the SHT3X sensor. Stores raw data, user uses get* functions to ret...
Definition: PWFusion_SHT3X.h:130
bool wasError()
If an error occurred during a transaction with the SHT3X device.
Definition: PWFusion_SHT3X.cpp:125
float getTempC()
Convert raw register into formatted degrees C.
Definition: PWFusion_SHT3X.cpp:111
float getTempF()
Convert raw register into formatted degrees F.
Definition: PWFusion_SHT3X.cpp:116
float getRelativeHumidity()
Convert raw humidity register into relative humidity.
Definition: PWFusion_SHT3X.cpp:121
SHT3X device driver for Arduino.
Definition: PWFusion_SHT3X.h:181
bool begin(uint8_t address)
Initialize device driver.
Definition: PWFusion_SHT3X.cpp:14
PWFusion_SHT3X_Data measure()
Perform a one-shot measurement on the device and return the results.
Definition: PWFusion_SHT3X.cpp:38

Revision History

Author Date Comments
J. Steinlage 2017Feb Original Version
J. Simeone 2025Jun Upgrade Library - Add Docs

License

SOFTWARE LICENSE AGREEMENT: This code is released under the MIT License.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

‍Thanks to jothepro and his awesome doxygen theme