Skip to content

Instantly share code, notes, and snippets.

@PaulskPt
Last active May 4, 2025 12:44
Show Gist options
  • Save PaulskPt/1cf1b59d3fee9f66bed52ad50068b2fe to your computer and use it in GitHub Desktop.
Save PaulskPt/1cf1b59d3fee9f66bed52ad50068b2fe to your computer and use it in GitHub Desktop.
Seeed XIAO RP2350 BME280 sensor data on LCD of Expansion Board
#
# 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)
@PaulskPt
Copy link
Author

PaulskPt commented May 3, 2025

See: images

Micropython Shell output

>>> %Run -c $EDITOR_CONTENT

MPY: soft reboot
('23.79C', '1001.02hPa', '49.73%')
('23.81C', '1001.11hPa', '49.42%')
('23.80C', '1001.10hPa', '49.34%')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment