From eee0955b0b9b231cac1962b6317fbcb98ec09a2b Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Wed, 19 May 2021 08:51:30 -0700 Subject: [PATCH 1/2] Add Pico example and update gitignore --- .gitignore | 10 +++++++++- examples/bme280_simpletest_pico.py | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 examples/bme280_simpletest_pico.py diff --git a/.gitignore b/.gitignore index 1be4e54..a966824 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,17 @@ # # SPDX-License-Identifier: Unlicense +*.mpy +.idea __pycache__ _build *.pyc -*.mpy .env +.python-version +build*/ bundles +*.DS_Store +.eggs +dist +**/*.egg-info +.vscode diff --git a/examples/bme280_simpletest_pico.py b/examples/bme280_simpletest_pico.py new file mode 100644 index 0000000..7ddc93a --- /dev/null +++ b/examples/bme280_simpletest_pico.py @@ -0,0 +1,26 @@ +# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries +# SPDX-License-Identifier: MIT + +import time +import board +import busio +import adafruit_bme280 + +# Create sensor object, using the board's default I2C bus. +i2c = busio.I2C(board.GP1, board.GP0) # SCL, SDA +bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c) + +# OR create sensor object, using the board's default SPI bus. +# spi = busio.SPI(board.GP2, MISO=board.GP0, MOSI=board.GP3) +# bme_cs = digitalio.DigitalInOut(board.GP1) +# bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, bme_cs) + +# change this to match the location's pressure (hPa) at sea level +bme280.sea_level_pressure = 1013.25 + +while True: + print("\nTemperature: %0.1f C" % bme280.temperature) + print("Humidity: %0.1f %%" % bme280.relative_humidity) + print("Pressure: %0.1f hPa" % bme280.pressure) + print("Altitude = %0.2f meters" % bme280.altitude) + time.sleep(2) From 7699692a8e109613e66457bbed695bb3579bb2da Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Wed, 19 May 2021 09:06:38 -0700 Subject: [PATCH 2/2] Re-ran pre-commit hooks --- examples/bme280_simpletest_pico.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/bme280_simpletest_pico.py b/examples/bme280_simpletest_pico.py index 7ddc93a..d433b44 100644 --- a/examples/bme280_simpletest_pico.py +++ b/examples/bme280_simpletest_pico.py @@ -7,7 +7,7 @@ import adafruit_bme280 # Create sensor object, using the board's default I2C bus. -i2c = busio.I2C(board.GP1, board.GP0) # SCL, SDA +i2c = busio.I2C(board.GP1, board.GP0) # SCL, SDA bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c) # OR create sensor object, using the board's default SPI bus.