Skip to content
CircuitPython driver for Adafruit's HTU21D-F temperature and humidity sensor
Python
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows Ran black, updated to pylint 2.x Mar 15, 2020
docs Ran black, updated to pylint 2.x Mar 15, 2020
examples Minor cleanup Sep 14, 2018
.gitignore Moved repository from Travis to GitHub Actions Jan 1, 2020
.pylintrc
.readthedocs.yml First commit Sep 14, 2018
CODE_OF_CONDUCT.md
LICENSE First commit Sep 14, 2018
README.rst Moved repository from Travis to GitHub Actions Jan 1, 2020
adafruit_htu21d.py Ran black, updated to pylint 2.x Mar 15, 2020
requirements.txt Remove register dependency Sep 25, 2018
setup.py Ran black, updated to pylint 2.x Mar 15, 2020

README.rst

Introduction

Documentation Status Discord Build Status

This driver enables you to use the Adafruit HTU21D-F temperature and humidity breakout with CircuitPyton.

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-htu21d

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

sudo pip3 install adafruit-circuitpython-htu21d

To install in a virtual environment in your current project:

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

Usage Example

import time
import board
import busio
from adafruit_htu21d import HTU21D

# Create library object using our Bus I2C port
i2c = busio.I2C(board.SCL, board.SDA)
sensor = HTU21D(i2c)


while True:
    print("\nTemperature: %0.1f C" % sensor.temperature)
    print("Humidity: %0.1f %%" % sensor.relative_humidity)
    time.sleep(2)

Contributing

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

Documentation

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

You can’t perform that action at this time.