: bme280

BME280 pressure, temperature and humidity sensor

Methods

: obj = bme280(arObj)
: obj = bme280(arObj, propertyname, propertyvalue ....)

Constructor to create BME280 sensor

Inputs

arObj - the arduino parent object

propertyname, propertyvalue - optional property name, value pairs. Current known properties are: Current properties are:

I2CAddress

I2C address of the sensor (default 0x40)

Bus

I2C bus - 0 or 1 (default 0)

Outputs

obj - created object

Example


a = arduino()
sensor = bme280(a)

: [C, timestamp] = readTemperature(obj)

Read the temperature

Inputs

obj - the sensor object

Outputs

C - read temperature in deg C.

timestamp - timestamp when read

Example


a = arduino()
s = bme280(a)
# get temp
temp = s.readTemperature

See also: bme280.

: [relH, timestamp] = readHumidity(obj)

Read the relative humidity

Inputs

obj - the sensor object

Outputs

relH - relative humidity as a percentage (0 - 100.0)

timestamp - timestamp when read

: [P, timestamp] = readPressure(obj)

Read the pressure

Inputs

obj - the sensor object

Outputs

P - pressure reading from sensor.

timestamp - timestamp when read

: [readings, overrun] = read(obj)
: [P, H, C, timestamp, overrun] = read(obj)

Read the sensor data

Inputs

obj - the sensor object

Outputs

P - pressure reading from sensor.

H - humidity reading from sensor.

C - temperature reading from sensor.

timestamp - timestamp when read

overrun - overrun flag.

readings - table structure with fields for Timestamp, Pressure, Temperature and Humidity.

: inf = info(obj)

Read the sensor info

Inputs

obj - the sensor object

Outputs

inf - structure containing the sensor information.

Structure fields are:

Version

Chip firmware version

SensorId

sensor id value

Type

sensor type ’bme280’

Status

Status value read from sensor

: flush(obj)

Flush sensor data

Inputs

obj - the sensor object

Outputs

None

: release(obj)

Release the resources of the sensor

Inputs

obj - the sensor object

Outputs

None

Package: arduino