From 142d7bd8b4b2b7bf3c17cbca165b8a2cabce11fd Mon Sep 17 00:00:00 2001 From: D Delmar Davis Date: Wed, 2 Aug 2023 12:32:49 -0700 Subject: Stubb in AHTx0 code --- readtemp.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'readtemp.py') diff --git a/readtemp.py b/readtemp.py index fe7669c..7c5e9ea 100755 --- a/readtemp.py +++ b/readtemp.py @@ -6,11 +6,14 @@ import sys import board import adafruit_tc74 +import adafruit_ahtx0 import tempfile import os GotTemperature = False +GotHumidity = False TempRead=0 +HumidityRead=0 i2c = board.I2C() # uses board.SCL and board.SDA for tempsensorid in i2c.scan(): @@ -19,6 +22,12 @@ for tempsensorid in i2c.scan(): sensor = adafruit_tc74.TC74(i2c) TempRead=sensor.temperature GotTemperature = True + if (tempsensorid==38): + print ("found an AHTx0") + sensor = adafruit_ahtx0.AHTx0(i2c) + TempRead=sensor.temperature + GotTemperature = True + HumidityRead = sensor.relative_humidity if (GotTemperature): -- cgit v1.2.3