Documentation
¶
Overview ¶
Package bme280 provides a driver for the BME280 temperature, humidity, and pressure sensor using I2C communication.
Index ¶
- Constants
- Variables
- func ConvertCtoF(celsius float64) float64
- type BME280
- func (b *BME280) Close() error
- func (b *BME280) Get() (resp *bme280.Response, err error)
- func (b *BME280) ID() string
- func (b *BME280) MockRead() (*bme280.Response, error)
- func (b *BME280) Open() error
- func (b *BME280) Set(v *bme280.Response) error
- func (b *BME280) String() string
- func (b *BME280) Type() devices.Type
- type BME280Config
- type Env
- type Response
Constants ¶
View Source
const ( DefaultI2CBus = "/dev/i2c-1" DefaultI2CAddress = 0x77 )
Variables ¶
Functions ¶
func ConvertCtoF ¶
ConvertCtoF converts Celsius to Fahrenheit
Types ¶
type BME280 ¶
type BME280 struct {
devices.Device[*bme280.Response]
MockReader func() (*bme280.Response, error) // Function to mock reading data
// contains filtered or unexported fields
}
BME280 represents an I2C temperature, humidity and pressure sensor. It defaults to address 0x77 and implements the device.Device interface.
func New ¶
Create a new BME280 at the give bus and address. Defaults are typically /dev/i2c-1 address 0x99
func (*BME280) Get ¶
Read one Response from the sensor. If this device is being mocked we will make up some random floating point numbers between 0 and 100.
type BME280Config ¶
type BME280Config struct {
Mode bme280.Mode
Filter bme280.Filter
Standby bme280.StandByTime
Oversample struct {
Pressure bme280.Oversampling
Temperature bme280.Oversampling
Humidity bme280.Oversampling
}
}
BME280Config holds the configuration for the BME280 sensor
func DefaultConfig ¶
func DefaultConfig() BME280Config
DefaultConfig returns the default configuration
Click to show internal directories.
Click to hide internal directories.