MicroPython SHT20 Library¶
sht20
¶
MicroPython Driver for the Sensirion SHT20 Temperature Sensor
Author(s): Jose D. Montoya
-
class micropython_sht20.sht20.SHT20(i2c, address: int =
0x40
)[source]¶ Driver for the SHT20 Sensor connected over I2C.
- Parameters:¶
- Raises:¶
RuntimeError – if the sensor is not found
Quickstart: Importing and using the device
Here is an example of using the
SHT20
class. First you will need to import the libraries to use the sensorfrom machine import Pin, I2C from micropython_sht20 import sht20
Once this is done you can define your
machine.I2C
object and define your sensor objecti2c = I2C(1, sda=Pin(2), scl=Pin(3)) sht20 = sht20.SHT20(i2c)
Now you have access to the attributes
temperature = sht20.temperature humidity = sht20.humidity
- reset() None [source]¶
Perform a soft reset of the sensor, resetting all settings to their power-on defaults