Skip to main content

Class Bh1745

Represents a BH1745 Luminance and Color Sensor

Assembly: Bh1745.dll​
View Source​
Declaration
public class Bh1745 : ByteCommsSensorBase<(Illuminance? AmbientLight, Color? Color, bool Valid)>, IObservable<IChangeResult<(Illuminance? AmbientLight, Color? Color, bool Valid)>>, ISamplingSensor<(Illuminance? AmbientLight, Color? Color, bool Valid)>, ISensor<(Illuminance? AmbientLight, Color? Color, bool Valid)>, IDisposable, ILightSensor, ISamplingSensor<Illuminance>, ISensor<Illuminance>, ISensor, ISamplingSensor, II2cPeripheral

Inheritance: System.Object -> Meadow.Foundation.ObservableBase<UNIT>

Implements:

Expand

System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Color>,System.Boolean>>>, Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Color>,System.Boolean>>, Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Color>,System.Boolean>>, System.IDisposable, Meadow.Peripherals.Sensors.Light.ILightSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Illuminance>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Illuminance>, Meadow.Peripherals.Sensors.ISensor, Meadow.Peripherals.Sensors.ISamplingSensor, Meadow.Hardware.II2cPeripheral

Properties​

Illuminance​

The current Illuminance value

View Source​
Declaration
public Illuminance? Illuminance { get; }

InterruptReset​

Interrupt reset status

View Source​
Declaration
public Bh1745.InterruptStatus InterruptReset { get; set; }

MeasurementTime​

Gets or sets the currently set measurement time

View Source​
Declaration
public Bh1745.MeasurementTimeType MeasurementTime { get; set; }

IsMeasurementActive​

Is the sensor actively measuring

View Source​
Declaration
public bool IsMeasurementActive { get; set; }

AdcGain​

Gets or sets the ADC gain of the sensor

View Source​
Declaration
public Bh1745.AdcGainTypes AdcGain { get; set; }

InterruptSignalIsActive​

Is the interrupt active

View Source​
Declaration
public bool InterruptSignalIsActive { get; }

LatchBehavior​

Gets or sets how the interrupt pin latches

View Source​
Declaration
public Bh1745.LatchBehaviorTypes LatchBehavior { get; set; }

InterruptSource​

Gets or sets the source channel that triggers the interrupt

View Source​
Declaration
public Bh1745.InterruptChannels InterruptSource { get; set; }

InterruptIsEnabled​

Gets or sets whether the interrupt pin is enabled

View Source​
Declaration
public bool InterruptIsEnabled { get; set; }

InterruptPersistence​

Gets or sets the persistence function of the interrupt

View Source​
Declaration
public Bh1745.InterruptTypes InterruptPersistence { get; set; }

LowerInterruptThreshold​

Gets or sets the lower interrupt threshold

View Source​
Declaration
public ushort LowerInterruptThreshold { get; set; }

UpperInterruptThreshold​

Gets or sets the upper interrupt threshold

View Source​
Declaration
public ushort UpperInterruptThreshold { get; set; }

CompensationMultipliers​

Gets or sets the channel compensation multipliers which are used to scale the channel measurements

View Source​
Declaration
public Bh1745.ChannelMultipliers CompensationMultipliers { get; set; }

DefaultI2cAddress​

The default I2C address for the peripheral

View Source​
Declaration
public byte DefaultI2cAddress { get; }

Methods​

ReadSensor()​

Reads data from the sensor

View Source​
Declaration
protected override Task<(Illuminance? AmbientLight, Color? Color, bool Valid)> ReadSensor()
Returns​

System.Threading.Tasks.Task<System.ValueTuple<System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Color>,System.Boolean>>: The latest sensor reading### RaiseEventsAndNotify(IChangeResult<(Illuminance? AmbientLight, Color? Color, bool Valid)>) Raise events for subscribers and notify of value changes

View Source​
Declaration
protected override void RaiseEventsAndNotify(IChangeResult<(Illuminance? AmbientLight, Color? Color, bool Valid)> changeResult)
Parameters​
TypeNameDescription
Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Color>,System.Boolean>>changeResultThe updated sensor data

Reset()​

Resets the device to the default configuration On reset the sensor goes to power down mode

View Source​
Declaration
protected void Reset()

ReadMeasurementIsValid()​

Reads whether the last measurement is valid

View Source​
Declaration
protected bool ReadMeasurementIsValid()
Returns​

System.Boolean

ReadRedDataRegister()​

Reads the red data register of the sensor

View Source​
Declaration
protected ushort ReadRedDataRegister()
Returns​

System.UInt16

ReadGreenDataRegister()​

Reads the green data register of the sensor

View Source​
Declaration
protected ushort ReadGreenDataRegister()
Returns​

System.UInt16

ReadBlueDataRegister()​

Reads the blue data register of the sensor

View Source​
Declaration
protected ushort ReadBlueDataRegister()
Returns​

System.UInt16

ReadClearDataRegister()​

Reads the clear data register of the sensor

View Source​
Declaration
protected ushort ReadClearDataRegister()
Returns​

System.UInt16

Implements​

  • System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Color>,System.Boolean>>>
  • Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Color>,System.Boolean>>
  • Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Color>,System.Boolean>>
  • System.IDisposable
  • Meadow.Peripherals.Sensors.Light.ILightSensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Illuminance>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Illuminance>
  • Meadow.Peripherals.Sensors.ISensor
  • Meadow.Peripherals.Sensors.ISamplingSensor
  • Meadow.Hardware.II2cPeripheral