File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 2
2
#
3
3
# SPDX-License-Identifier: Unlicense
4
4
5
+ * .mpy
6
+ .idea
5
7
__pycache__
6
8
_build
7
9
* .pyc
8
- * .mpy
9
10
.env
11
+ .python-version
12
+ build * /
10
13
bundles
14
+ * .DS_Store
15
+ .eggs
16
+ dist
17
+ ** /* .egg-info
18
+ .vscode
Original file line number Diff line number Diff line change
1
+ # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ import time
5
+ import board
6
+ import busio
7
+ import adafruit_bme280
8
+
9
+ # Create sensor object, using the board's default I2C bus.
10
+ i2c = busio .I2C (board .GP1 , board .GP0 ) # SCL, SDA
11
+ bme280 = adafruit_bme280 .Adafruit_BME280_I2C (i2c )
12
+
13
+ # OR create sensor object, using the board's default SPI bus.
14
+ # spi = busio.SPI(board.GP2, MISO=board.GP0, MOSI=board.GP3)
15
+ # bme_cs = digitalio.DigitalInOut(board.GP1)
16
+ # bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, bme_cs)
17
+
18
+ # change this to match the location's pressure (hPa) at sea level
19
+ bme280 .sea_level_pressure = 1013.25
20
+
21
+ while True :
22
+ print ("\n Temperature: %0.1f C" % bme280 .temperature )
23
+ print ("Humidity: %0.1f %%" % bme280 .relative_humidity )
24
+ print ("Pressure: %0.1f hPa" % bme280 .pressure )
25
+ print ("Altitude = %0.2f meters" % bme280 .altitude )
26
+ time .sleep (2 )
You can’t perform that action at this time.
0 commit comments