MicroPython STTS22H Library¶
stts22h
¶
MicroPython Driver for the STTS22H Temperature Sensor
Author(s): Jose D. Montoya
-
class micropython_stts22h.stts22h.STTS22H(i2c, address: int =
0x3C
)[source]¶ Driver for the STTS22H 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
STTS22H
class. First you will need to import the libraries to use the sensorfrom machine import Pin, I2C from micropython_stts22h import stts22h
Once this is done you can define your
machine.I2C
object and define your sensor objecti2c = I2C(1, sda=Pin(2), scl=Pin(3)) stts = stts22h.STTS22H(i2c)
Now you have access to the attributes
temp = stts.temperature
- property high_limit : bool¶
The bit is automatically reset to ‘0’ upon reading the STATUS register. :return: value if the temperature exceeds the high limit
- property low_limit : bool¶
The bit is automatically reset to ‘0’ upon reading the STATUS register. :return: value if the temperature went under the low limit