Skip to content

Instantly share code, notes, and snippets.

@djotaku
Created August 5, 2020 03:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djotaku/d1a0613393bb9f285cddf9acf1107955 to your computer and use it in GitHub Desktop.
Save djotaku/d1a0613393bb9f285cddf9acf1107955 to your computer and use it in GitHub Desktop.
unsuccessful humidity readings from ahtx0
import time
import board
import adafruit_ahtx0
# Create the sensor object using I2C
sensor = adafruit_ahtx0.AHTx0(board.I2C())
while True:
#temp = (sensor.temperature * 9.0/5.0) + 32
temp = sensor.temperature * 1.8 + 32
print(f"\nTemperature: {temp:0.1f} F")
print(f"status: {sensor.status}")
print(f"Humidity: {sensor.relative_humidity:0.1f} %" )
time.sleep(2)
####
Here is the output I get to the commandline:
Tempuerature: 77.2 F
status: 28
Humidity: 0.0%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment