adafruit / Adafruit_CircuitPython_HTU21D

CircuitPython driver for Adafruit's HTU21D-F temperature and humidity sensor
MIT License
2 stars 9 forks source link

htu21d_simpletest.py example breaks under 5.x beta.5 #8

Closed geekguy-wy closed 4 years ago

geekguy-wy commented 4 years ago

I changed two lines in the example to get it to work with the Feb 18th library bundle.

Change this:

while True:
    print("\nTemperature: %0.1f C" % sensor.temperature)
    print("Humidity: %0.1f %%" % sensor.relative_humidity)
    time.sleep(2)

to this:

while True:
    print("Temperature: {0:4.1f}°C".format(sensor.measurement(TEMPERATURE)))
    print("Humidity:    {0:4.1f}%".format(sensor.measurement(HUMIDITY)))
    time.sleep(2)
geekguy-wy commented 4 years ago

This issue was in error. Everything works fine as is.