Home

Awesome

micropython-bmp280

Inspired by
https://github.com/vitally/BMP280
https://github.com/micropython-IMU/micropython-bmp180

Constructor

BMP280(i2c_bus, addr=0x76, use_case=BMP280_CASE_HANDHELD_DYN)

Enums

Values for different settings are defined in the following constants. Reference to manual section in parenthesis.

Use cases (See 3.4, 3.8.2)

Oversampling setting (See 3.3.1, 3.8.2)

Pressure oversampling (See 3.3.1)

Temperature oversampling (See 3.3.2)

IIR filter (See 3.3.3)

Standby settings for Normal measure (See 3.6.3)

Power modes

SPI 3-wire select

Example

from machine import I2C
from bmp280 import *

bus = I2C()
bmp = BMP280(bus)

bmp.use_case(BMP280_CASE_WEATHER)
bmp.oversample(BMP280_OS_HIGH)

bmp.temp_os = BMP280_TEMP_OS_8
bmp.press_os = BMP280_PRES_OS_4

bmp.standby = BMP280_STANDBY_250
bmp.iir = BMP280_IIR_FILTER_2

bmp.spi3w = BMP280_SPI3W_ON

bmp.power_mode = BMP280_POWER_FORCED
# or 
bmp.force_measure()

bmp.power_mode = BMP280_POWER_NORMAL
# or 
bmp.normal_measure()
# also
bmp.in_normal_mode()

bmp.power_mode = BMP280_POWER_SLEEP
# or 
bmp.sleep()

print(bmp.temperature)
print(bmp.pressure)

#True while measuring
bmp.is_measuring

#True while copying data to registers
bmp.is_updating

TODO