Documentation ¶
Overview ¶
Package bme280 provides a driver for the BME280 digital combined humidity and pressure sensor by Bosch.
Datasheet: https://cdn-shop.adafruit.com/datasheets/BST-BME280_DS001-10.pdf
Index ¶
Constants ¶
const ( CTRL_MEAS_ADDR = 0xF4 CTRL_HUMIDITY_ADDR = 0xF2 CTRL_CONFIG = 0xF5 REG_PRESSURE = 0xF7 REG_CALIBRATION = 0x88 REG_CALIBRATION_H1 = 0xA1 REG_CALIBRATION_H2LSB = 0xE1 CMD_RESET = 0xE0 WHO_AM_I = 0xD0 CHIP_ID = 0x60 )
Registers. Names, addresses and comments copied from the datasheet.
const Address = 0x76
The I2C address which this device listens to.
const (
SEALEVEL_PRESSURE float32 = 1013.25 // in hPa
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct { Address uint16 // contains filtered or unexported fields }
Device wraps an I2C connection to a BME280 device.
func New ¶
New creates a new BME280 connection. The I2C bus must already be configured.
This function only creates the Device object, it does not touch the device.
func (*Device) Configure ¶
func (d *Device) Configure()
Configure sets up the device for communication and read the calibration coefficientes.
func (*Device) Connected ¶
Connected returns whether a BME280 has been found. It does a "who am I" request and checks the response.
func (*Device) ReadAltitude ¶
ReadAltitude returns the current altitude in meters based on the current barometric pressure and estimated pressure at sea level. Calculation is based on code from Adafruit BME280 library
https://github.com/adafruit/Adafruit_BME280_Library
func (*Device) ReadHumidity ¶
ReadHumidity returns the relative humidity in hundredths of a percent
func (*Device) ReadPressure ¶
ReadPressure returns the pressure in milli pascals mPa
func (*Device) ReadTemperature ¶
ReadTemperature returns the temperature in celsius milli degrees (ºC/1000)