File tree 2 files changed +9
-9
lines changed
2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -58,23 +58,23 @@ Usage Example
58
58
59
59
.. code-block :: python
60
60
61
+ import time
61
62
import board
62
- import digitalio
63
+ # import digitalio # For use with SPI
63
64
import busio
64
- import time
65
- from adafruit_bmp280 import adafruit_bmp280
65
+ import adafruit_bmp280
66
66
67
67
# Create library object using our Bus I2C port
68
68
i2c = busio.I2C(board.SCL , board.SDA )
69
69
bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c)
70
70
71
71
# OR create library object using our Bus SPI port
72
- # spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
73
- # bmp_cs = digitalio.DigitalInOut(board.D10)
74
- # bmp280 = adafruit_bmp280.Adafruit_BMP280_SPI(spi, bmp_cs)
72
+ # spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
73
+ # bmp_cs = digitalio.DigitalInOut(board.D10)
74
+ # bmp280 = adafruit_bmp280.Adafruit_BMP280_SPI(spi, bmp_cs)
75
75
76
76
# change this to match the location's pressure (hPa) at sea level
77
- bmp280.seaLevelhPa = 1013.25
77
+ bmp280.sea_level_pressure = 1013.25
78
78
79
79
while True :
80
80
print (" \n Temperature: %0.1f C" % bmp280.temperature)
Original file line number Diff line number Diff line change
1
+ """Simpletest Example that shows how to get temperature,
2
+ pressure, and altitude readings from a BMP280"""
1
3
import time
2
-
3
4
import board
4
5
5
6
# import digitalio # For use with SPI
6
7
import busio
7
-
8
8
import adafruit_bmp280
9
9
10
10
# Create library object using our Bus I2C port
You can’t perform that action at this time.
0 commit comments