Table of Contents
Wiring #

Pico pin: | BMP280 pin: |
---|---|
+5V | +5V (VCC) |
GND | GND |
1 | SCL Serial Clock (line) |
0 | SCA Serial Clock (data) |
Script flrrth-pico-bmp280 bibliotheek #
Download Github: https://github.com/flrrth/pico-bmp280
Example code
from machine import Pin, I2C
from utime import sleep
from bmp280 import BMP280I2C
i2c0_sda = Pin(0)
i2c0_scl = Pin(1)
i2c0 = I2C(0, sda=i2c0_sda, scl=i2c0_scl, freq=400000)
bmp280_i2c = BMP280I2C(0x76, i2c0) # address may be different
while True:
readout = bmp280_i2c.measurements
print(f"Temperature: {readout['t']} °C, pressure: {readout['p']} hPa.")
sleep(1)
Output:
