Documentation ¶
Overview ¶
Package bme280 allows interfacing with Bosch BME280 digital humidity, pressure and temperature sensor.
Index ¶
Constants ¶
const ( CAL_T1_LSB_REG = 0x88 CAL_T1_MSB_REG = 0x89 CAL_T2_LSB_REG = 0x8A CAL_T2_MSB_REG = 0x8B CAL_T3_LSB_REG = 0x8C CAL_T3_MSB_REG = 0x8D CAL_P1_LSB_REG = 0x8E CAL_P1_MSB_REG = 0x8F CAL_P2_LSB_REG = 0x90 CAL_P2_MSB_REG = 0x91 CAL_P3_LSB_REG = 0x92 CAL_P3_MSB_REG = 0x93 CAL_P4_LSB_REG = 0x94 CAL_P4_MSB_REG = 0x95 CAL_P5_LSB_REG = 0x96 CAL_P5_MSB_REG = 0x97 CAL_P6_LSB_REG = 0x98 CAL_P6_MSB_REG = 0x99 CAL_P7_LSB_REG = 0x9A CAL_P7_MSB_REG = 0x9B CAL_P8_LSB_REG = 0x9C CAL_P8_MSB_REG = 0x9D CAL_P9_LSB_REG = 0x9E CAL_P9_MSB_REG = 0x9F CAL_H1_REG = 0xA1 CAL_H2_LSB_REG = 0xE1 CAL_H2_MSB_REG = 0xE2 CAL_H3_REG = 0xE3 CAL_H4_MSB_REG = 0xE4 CAL_H4_LSB_REG = 0xE5 CAL_H5_MSB_REG = 0xE6 CAL_H6_REG = 0xE7 MEASUREMENT_START_REG = 0xF7 PRESSURE_MSB_IDX = 0 PRESSURE_LSB_IDX = 1 PRESSURE_XLSB_IDX = 2 TMP_MSB_IDX = 3 TMP_LSB_IDX = 4 TMP_XLSB_IDX = 5 HUMIDITY_MSB_IDX = 6 HUMIDITY_LSB_IDX = 7 CTRL_MEAS_REG = 0xF4 CONFIG_REG = 0xF5 CTRL_HUMIDITY_REG = 0xF2 RESET_REG = 0xE0 //RunMode can be: // 0, Sleep mode // 1 or 2, Forced mode // 3, Normal mode RunMode = uint8(3) //Standby can be: // 0, 0.5ms // 1, 62.5ms // 2, 125ms // 3, 250ms // 4, 500ms // 5, 1000ms // 6, 10ms // 7, 20ms Standby = uint8(0) //Filter can be off or number of FIR coefficients to use: // 0, filter off // 1, coefficients = 2 // 2, coefficients = 4 // 3, coefficients = 8 // 4, coefficients = 16 Filter = uint8(0) //TempOverSample can be: // 0, skipped // 1 through 5, oversampling *1, *2, *4, *8, *16 respectivel TempOverSample = uint8(1) //PressOverSample can be: // 0, skipped // 1 through 5, oversampling *1, *2, *4, *8, *16 respectively PressOverSample = uint8(1) //HumidOverSample can be: // 0, skipped // 1 through 5, oversampling *1, *2, *4, *8, *16 respectively HumidOverSample = uint8(1) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BME280 ¶
type BME280 struct { Bus embd.I2CBus Addr byte Cal Calibration }
func New ¶
New creates and calibrates a connection to a BME280 sensor on the supplied i2c bus at the nominated i2c address.
func (*BME280) Humidity ¶
Humdity returns the relative humidity from the supplied measurements. Output value of "46.332" represents 46.332 %rH.
func (*BME280) Measurements ¶
Reads all measurements from the sensor. Call Humidity, Pressure or Temperature to retrieve calibrated readings.
func (*BME280) Pressure ¶
Returns the pressure in Pascals from the supplied measurements. A value of "96386.2" equals 963.862 hPa.
func (*BME280) Temperature ¶
Temperature returns the temperature in Degrees Celcius from the supplied measurements. Output value of "30.33" equals 30.33°C.