diff options
| author | D Delmar Davis <don@suspectdevices.com> | 2023-08-02 12:32:49 -0700 |
|---|---|---|
| committer | D Delmar Davis <don@suspectdevices.com> | 2023-08-02 12:32:49 -0700 |
| commit | 142d7bd8b4b2b7bf3c17cbca165b8a2cabce11fd (patch) | |
| tree | 1c332b42c7b97840031a0d26a2d4899c68cdf46d /readtemp.py | |
| parent | ae7f82479709970026dbb5584bb55de542d401ac (diff) | |
Stubb in AHTx0 code
Diffstat (limited to 'readtemp.py')
| -rwxr-xr-x | readtemp.py | 9 |
1 files changed, 9 insertions, 0 deletions
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): |
