Skip to main content

Python library for Sensirion SHT4x temperature and humidity sensors

Project description

Introduction

Documentation Status Discord Build Status Code Style: Black

Python library for Sensirion SHT4x temperature and humidity sensors

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install adafruit-circuitpython-sht4x

To install system-wide (this may be required in some cases):

sudo pip3 install adafruit-circuitpython-sht4x

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install adafruit-circuitpython-sht4x

Usage Example

import time
import board
import adafruit_sht4x

i2c = board.I2C()   # uses board.SCL and board.SDA
sht = adafruit_sht4x.SHT4x(i2c)
print("Found SHT4x with serial number", hex(sht.serial_number))

sht.mode = adafruit_sht4x.Mode.NOHEAT_HIGHPRECISION
# Can also set the mode to enable heater
# sht.mode = adafruit_sht4x.Mode.LOWHEAT_100MS
print("Current mode is: ", adafruit_sht4x.Mode.string[sht.mode])

while True:
    temperature, relative_humidity = sht.measurements
    print("Temperature: %0.1f C" % temperature)
    print("Humidity: %0.1f %%" % relative_humidity)
    print("")
    time.sleep(1)

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adafruit-circuitpython-sht4x-1.0.18.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file adafruit-circuitpython-sht4x-1.0.18.tar.gz.

File metadata

File hashes

Hashes for adafruit-circuitpython-sht4x-1.0.18.tar.gz
Algorithm Hash digest
SHA256 3c7435d29e8b16b79050729b581052f6da97493da43d030584f16ed1a564f2e9
MD5 cc2a685eac4e7fe76ebbb637d2e50049
BLAKE2b-256 f2d042331493ae5d5b95f3c9f1c9f91cd733cc9ade2ba29b2e596fa1674d7f5f

See more details on using hashes here.

File details

Details for the file adafruit_circuitpython_sht4x-1.0.18-py3-none-any.whl.

File metadata

File hashes

Hashes for adafruit_circuitpython_sht4x-1.0.18-py3-none-any.whl
Algorithm Hash digest
SHA256 8d26f9d01d1d9d0892a5a0da99d92bdb333974c0a2c9d59534ec420f69720102
MD5 db904b870e9f98fe8a4e388866fd89c4
BLAKE2b-256 7f7967dea78dabafa0057d84e7447b0d0024db5d652758a4f1df2947d11c072b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page