linting/sphinx updates
This commit is contained in:
parent
6581fab4d7
commit
be6e549059
2 changed files with 22 additions and 22 deletions
|
|
@ -77,12 +77,11 @@ def _crc16(data):
|
|||
|
||||
|
||||
class AM2320:
|
||||
"""
|
||||
A driver for the AM2320 temperature and humidity sensor.
|
||||
"""A driver for the AM2320 temperature and humidity sensor.
|
||||
|
||||
:param i2c_bus: The `busio.I2C` object to use. This is the only required parameter.
|
||||
:param int address: (optional) The I2C address of the device.
|
||||
|
||||
|
||||
"""
|
||||
def __init__(self, i2c_bus, address=AM2320_DEFAULT_ADDR):
|
||||
self._i2c = I2CDevice(i2c_bus, address)
|
||||
|
|
@ -111,7 +110,6 @@ class AM2320:
|
|||
raise RuntimeError('CRC failure 0x%04X vs 0x%04X' % (crc1, crc2))
|
||||
return result[2:-2]
|
||||
|
||||
|
||||
@property
|
||||
def temperature(self):
|
||||
"""The measured temperature in celsius."""
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
import board
|
||||
import busio
|
||||
import time
|
||||
import adafruit_am2320
|
||||
|
||||
# can also use board.SDA and board.SCL for neater looking code!
|
||||
i2c = busio.I2C(board.D2, board.D0)
|
||||
|
||||
|
||||
am = adafruit_am2320.AM2320(i2c)
|
||||
while True:
|
||||
try:
|
||||
print("Temperature: ", am.temperature)
|
||||
print("Humidity: ", am.relative_humidity)
|
||||
except:
|
||||
# These sensors are a bit flakey, its ok if the readings fail
|
||||
pass
|
||||
time.sleep(2)
|
||||
import time
|
||||
import board
|
||||
import busio
|
||||
import adafruit_am2320
|
||||
|
||||
# can also use board.SDA and board.SCL for neater looking code!
|
||||
i2c = busio.I2C(board.D2, board.D0)
|
||||
am = adafruit_am2320.AM2320(i2c)
|
||||
|
||||
|
||||
while True:
|
||||
try:
|
||||
print("Temperature: ", am.temperature)
|
||||
print("Humidity: ", am.relative_humidity)
|
||||
except OSError:
|
||||
# These sensors are a bit flakey, its ok if the readings fail
|
||||
pass
|
||||
except RuntimeError:
|
||||
pass
|
||||
time.sleep(2)
|
||||
|
|
|
|||
Loading…
Reference in a new issue