-
Notifications
You must be signed in to change notification settings - Fork 225
BME280 SENSOR
Jaume Olivé Petrus edited this page Jun 12, 2017
·
26 revisions
What | Comments | |
---|---|---|
Identifier | BME280 | |
Interface | I2C | |
Provides | temperature | celsius degrees |
humidity | % relative humidity | |
pressure | hPa | |
Properties | address | sensor address (r/w) |
mode | sensor mode (r/w) 0=sleep, 1=forced, 2=normal |
|
standbytime | standby time in msecs (r/w) | |
Datasheet |
-- Attach BME280 to I2C0, speed=400Khz
-- sda=GPIO14, scl=GPIO26, adress is 0x76
s1 = sensor.attach("BME280", i2c.I2C0, 400, 0x76)
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