Skip to content

Commit be6e549

Browse files
committed
linting/sphinx updates
1 parent 6581fab commit be6e549

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

adafruit_am2320.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,11 @@ def _crc16(data):
7777

7878

7979
class AM2320:
80-
"""
81-
A driver for the AM2320 temperature and humidity sensor.
80+
"""A driver for the AM2320 temperature and humidity sensor.
8281
8382
:param i2c_bus: The `busio.I2C` object to use. This is the only required parameter.
8483
:param int address: (optional) The I2C address of the device.
85-
84+
8685
"""
8786
def __init__(self, i2c_bus, address=AM2320_DEFAULT_ADDR):
8887
self._i2c = I2CDevice(i2c_bus, address)
@@ -111,7 +110,6 @@ def _read_register(self, register, length):
111110
raise RuntimeError('CRC failure 0x%04X vs 0x%04X' % (crc1, crc2))
112111
return result[2:-2]
113112

114-
115113
@property
116114
def temperature(self):
117115
"""The measured temperature in celsius."""

examples/am2320_simpletest.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
import board
2-
import busio
3-
import time
4-
import adafruit_am2320
5-
6-
# can also use board.SDA and board.SCL for neater looking code!
7-
i2c = busio.I2C(board.D2, board.D0)
8-
9-
10-
am = adafruit_am2320.AM2320(i2c)
11-
while True:
12-
try:
13-
print("Temperature: ", am.temperature)
14-
print("Humidity: ", am.relative_humidity)
15-
except:
16-
# These sensors are a bit flakey, its ok if the readings fail
17-
pass
18-
time.sleep(2)
1+
import time
2+
import board
3+
import busio
4+
import adafruit_am2320
5+
6+
# can also use board.SDA and board.SCL for neater looking code!
7+
i2c = busio.I2C(board.D2, board.D0)
8+
am = adafruit_am2320.AM2320(i2c)
9+
10+
11+
while True:
12+
try:
13+
print("Temperature: ", am.temperature)
14+
print("Humidity: ", am.relative_humidity)
15+
except OSError:
16+
# These sensors are a bit flakey, its ok if the readings fail
17+
pass
18+
except RuntimeError:
19+
pass
20+
time.sleep(2)

0 commit comments

Comments
 (0)