Documentation ¶
Overview ¶
Package bh1750 provides a driver for the BH1750 digital Ambient Light
Datasheet: https://www.mouser.com/ds/2/348/bh1750fvi-e-186247.pdf
Index ¶
Constants ¶
const ( POWER_DOWN = 0x00 POWER_ON = 0x01 RESET = 0x07 CONTINUOUS_HIGH_RES_MODE SamplingMode = 0x10 CONTINUOUS_HIGH_RES_MODE_2 SamplingMode = 0x11 CONTINUOUS_LOW_RES_MODE SamplingMode = 0x13 ONE_TIME_HIGH_RES_MODE SamplingMode = 0x20 ONE_TIME_HIGH_RES_MODE_2 SamplingMode = 0x21 ONE_TIME_LOW_RES_MODE SamplingMode = 0x23 // resolution in 10*lx HIGH_RES = 10 HIGH_RES2 = 5 LOW_RES = 40 )
Registers. Names, addresses and comments copied from the datasheet.
const Address = 0x23
The I2C address which this device listens to.
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 bh1750 device.
func New ¶
New creates a new bh1750 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
func (*Device) Illuminance ¶
Illuminance returns the adjusted value in mlx (milliLux)
func (*Device) RawSensorData ¶
RawSensorData returns the raw value from the bh1750
func (*Device) SetMode ¶
func (d *Device) SetMode(mode SamplingMode)
SetMode changes the reading mode for the sensor
type SamplingMode ¶
type SamplingMode byte
SamplingMode is the sampling's resolution of the measurement