Skip to main content

Class Tsl2591

Driver for the TSL2591 light-to-digital converter

Assembly: Tsl2591.dll
View Source
public class Tsl2591 : ByteCommsSensorBase<(Illuminance? FullSpectrum, Illuminance? Infrared, Illuminance? VisibleLight, Illuminance? Integrated)>, IObservable<IChangeResult<(Illuminance? FullSpectrum, Illuminance? Infrared, Illuminance? VisibleLight, Illuminance? Integrated)>>, ISamplingSensor<(Illuminance? FullSpectrum, Illuminance? Infrared, Illuminance? VisibleLight, Illuminance? Integrated)>, ISensor<(Illuminance? FullSpectrum, Illuminance? Infrared, Illuminance? VisibleLight, Illuminance? Integrated)>, ILightSensor, ISamplingSensor<Illuminance>, ISensor<Illuminance>, ISensor, ISamplingSensor, IDisposable, IPowerControllablePeripheral

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

Implements:

Expand

System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>>>>, Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>>>, Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>>>, 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, System.IDisposable, Meadow.IPowerControllablePeripheral

Properties

PackageID

Sensor package ID

View Source
public int PackageID { get; }

DeviceID

Sensor device ID

View Source
public int DeviceID { get; }

Gain

Gain of the sensor

View Source
public Tsl2591.GainFactor Gain { get; set; }

IntegrationTime

Integration time for the sensor

View Source
public Tsl2591.IntegrationTimes IntegrationTime { get; set; }

FullSpectrumLuminosity

Full spectrum luminosity (visible and infrared light combined)

View Source
public Illuminance? FullSpectrumLuminosity { get; }

InfraredLuminosity

Infrared light luminosity

View Source
public Illuminance? InfraredLuminosity { get; }

VisibleLightLuminosity

Visible light luminosity

View Source
public Illuminance? VisibleLightLuminosity { get; }

Illuminance

Visible lux

View Source
public Illuminance? Illuminance { get; }

Methods

ReadSensor()

Reads data from the sensor

View Source
protected override Task<(Illuminance? FullSpectrum, Illuminance? Infrared, Illuminance? VisibleLight, Illuminance? Integrated)> ReadSensor()
Returns

System.Threading.Tasks.Task<System.ValueTuple<System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>>>: The latest sensor reading### RaiseEventsAndNotify(IChangeResult<(Illuminance? FullSpectrum, Illuminance? Infrared, Illuminance? VisibleLight, Illuminance? Integrated)>) Raise events for subscribers and notify of value changes

View Source
protected override void RaiseEventsAndNotify(IChangeResult<(Illuminance? FullSpectrum, Illuminance? Infrared, Illuminance? VisibleLight, Illuminance? Integrated)> changeResult)
Parameters
TypeNameDescription
Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>>>changeResultThe updated sensor data

PowerOn()

Power the sensor on

View Source
public Task PowerOn()
Returns

System.Threading.Tasks.Task

PowerOff()

Power the sensor off

View Source
public Task PowerOff()
Returns

System.Threading.Tasks.Task

Events

FullSpectrumUpdated

Raised when Full Spectrum Illuminance value changes

View Source
public event EventHandler<IChangeResult<Illuminance>> FullSpectrumUpdated
Event Type

System.EventHandler<Meadow.IChangeResult<Meadow.Units.Illuminance>>

InfraredUpdated

Raised when Infrared Illuminance value changes

View Source
public event EventHandler<IChangeResult<Illuminance>> InfraredUpdated
Event Type

System.EventHandler<Meadow.IChangeResult<Meadow.Units.Illuminance>>

VisibleLightUpdated

Raised when Visible Light value changes

View Source
public event EventHandler<IChangeResult<Illuminance>> VisibleLightUpdated
Event Type

System.EventHandler<Meadow.IChangeResult<Meadow.Units.Illuminance>>

Updated

Raised when Luminosity value changes

View Source
public event EventHandler<IChangeResult<Illuminance>> Updated
Event Type

System.EventHandler<Meadow.IChangeResult<Meadow.Units.Illuminance>>

Implements

  • System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>>>>
  • Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>>>
  • Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>,System.Nullable<Meadow.Units.Illuminance>>>
  • 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
  • System.IDisposable
  • Meadow.IPowerControllablePeripheral