GreenPonik_SHT40.py Library for Raspberry pi
This is the sample code for read light with SHT40 sensor.
Table of Contents
Installation
> git clone https://github.com/GreenPonik/GreenPonik_SHT40.git
cd GreenPonik_SHT40
pip3 install -r requirements.txt
or
> pip3 install greenponik-sht40
from GreenPonik_SHT40.SHT40 import SHT40
Methods
"""
Get light data
"""
def read_sht40():
Example
import time
from GreenPonik_SHT40.SHT40 import SHT40
if __name__ == "__main__":
try:
sht = SHT40()
while True:
data = sht.read_sht40()
print("temperature: %.2f / humidity: %.2f" % (data[0], data[1]))
time.sleep(1)
except Exception as e:
print('An exception occurred: {}'.format(e))
Credits
Code by Mickael Lehoux, from GreenPonik, 2021