Go driver for the Bosch BME280 sensor.
// Error handling is omitted
device, err := i2c.Open(&i2c.Devfs{Dev: "/dev/i2c-1"}, bme280.I2CAddr)
driver := bme280.New(device)
err = driver.InitWith(bme280.ModeForced, bme280.Settings{
Filter: bme280.FilterOff,
Standby: bme280.StandByTime1000ms,
PressureOversampling: bme280.Oversampling16x,
TemperatureOversampling: bme280.Oversampling16x,
HumidityOversampling: bme280.Oversampling16x,
})
response, err := driver.Read()
- Datasheet
- Reference driver
- quhar/bme280 - another BME280 driver written in Go worth considering
- periph.io - if you're considering to use a whole low-level peripherals library in Go (it has BME280 support)