Skip to content

BME280 SENSOR

Jaume Olivé Petrus edited this page Jun 15, 2017 · 26 revisions

Specification

What Comments
Identifier BME280
Interface I2C
Provides temperature celsius degrees
humidity % relative humidity
pressure hPa
Properties mode sensor mode (r/w)
0=sleep, 1=forced, 2=normal
standbytime standby time in msecs (r/w)
Notes BME280 adress is 0x76 (default) or 0x77
Datasheet

Code

-- Attach BME280 to I2C0, with default values
s1 = sensor.attach("BME280", i2c.I2C0)

while true do
  -- Read temperature
  temperature = s1:read("temperature")

  -- Read humidity
  humidity = s1:read("humidity")

  -- Read preassure
  pressure = s1:read("pressure")

  -- Print results
  print("temp: "..temperature..", humidity: "..humidity..", pressure: "..pressure)

  tmr.delayms(500)
end
Clone this wiki locally