Last active
May 4, 2025 12:44
-
-
Save PaulskPt/1cf1b59d3fee9f66bed52ad50068b2fe to your computer and use it in GitHub Desktop.
Seeed XIAO RP2350 BME280 sensor data on LCD of Expansion Board
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Example. Using I2C at P7, P6 | |
# Micropython | |
# BME280 sensor (part of Pimoroni multi-sensor-stick PIM745) | |
# | |
from machine import I2C | |
from lib.bme280_float import * | |
from lib.ssd1306 import SSD1306_I2C | |
from utime import sleep | |
PIN_WIRE1_SCL = machine.Pin.board.GP7 | |
PIN_WIRE1_SDA = machine.Pin.board.GP6 | |
i2c = machine.I2C(id=1, scl=machine.Pin(PIN_WIRE1_SCL), sda=machine.Pin(PIN_WIRE1_SDA), freq=400000) | |
bme280 = BME280(i2c=i2c) | |
oled = SSD1306_I2C(128, 32, i2c) | |
while True: | |
print(bme280.values) | |
t = "T: {:s}".format(bme280.values[0]) | |
p = "P: {:s}".format(bme280.values[1]) | |
h = "H: {:s}".format(bme280.values[2]) | |
oled.fill(0) | |
oled.text(t, 0, 0) | |
oled.text(p, 0, 10) | |
oled.text(h, 0, 20) | |
oled.show() | |
sleep(3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See: images
Micropython Shell output