Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Python library for SHT4x temperature / humidity sensors

License

NotificationsYou must be signed in to change notification settings

adafruit/Adafruit_CircuitPython_SHT4x

Repository files navigation

Introduction

Documentation StatusDiscordBuild StatusCode Style: Ruff

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 downloadingthe Adafruit library and driver bundle.

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfromPyPI. 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-namepython3 -m venv .venvsource .venv/bin/activatepip3 install adafruit-circuitpython-sht4x

Usage Example

importtimeimportboardimportadafruit_sht4xi2c=board.I2C()# uses board.SCL and board.SDAsht=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_100MSprint("Current mode is: ",adafruit_sht4x.Mode.string[sht.mode])whileTrue:temperature,relative_humidity=sht.measurementsprint("Temperature: %0.1f C"%temperature)print("Humidity: %0.1f %%"%relative_humidity)print("")time.sleep(1)

Documentation

API documentation for this library can be found onRead the Docs.

For information on building library documentation, please check outthis guide.

Contributing

Contributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.

About

Python library for SHT4x temperature / humidity sensors

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors9

Languages


[8]ページ先頭

©2009-2025 Movatter.jp