This is the sample code for read light with SHT40 sensor.
> 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
"""
Get light data
"""
def read_sht40():
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))
Code by Mickael Lehoux, from GreenPonik, 2021