Class AnalogLightSensor
Represents an analog light sensor
Assembly: Meadow.Foundation.dll
View Source
public class AnalogLightSensor : SamplingSensorBase<Illuminance>, IObservable<IChangeResult<Illuminance>>, ILightSensor, ISamplingSensor<Illuminance>, ISensor<Illuminance>, ISensor, ISamplingSensor, IDisposable
Inheritance: System.Object
-> Meadow.Foundation.ObservableBase<UNIT>
Implements:
System.IObservable<Meadow.IChangeResult<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
Properties
AnalogInputPort
Analog port connected to sensor
View Source
protected IAnalogInputPort AnalogInputPort { get; }
LuminanceCalibration
Illuminance sensor calibration
View Source
public AnalogLightSensor.Calibration LuminanceCalibration { get; protected set; }
Illuminance
Current illuminance value read by sensor
View Source
public Illuminance? Illuminance { get; }
IsDisposed
Is the object disposed
View Source
public bool IsDisposed { get; }
Methods
ReadSensor()
Convenience method to get the current luminance. For frequent reads, use StartSampling() and StopSampling() in conjunction with the SampleBuffer.
View Source
protected override Task<Illuminance> ReadSensor()
Returns
System.Threading.Tasks.Task<Meadow.Units.Illuminance>
StartUpdating(TimeSpan?)
Starts continuously sampling the sensor.
This method also starts raising Changed
events and IObservable
subscribers getting notified. Use the readIntervalDuration
parameter
to specify how often events and notifications are raised/sent.
View Source
public override void StartUpdating(TimeSpan? updateInterval)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.TimeSpan> | updateInterval | A TimeSpan that specifies how long to |
wait between readings. This value influences how often `*Updated`
events are raised and `IObservable` consumers are notified.
The default is 5 seconds. |
StopUpdating()
Stops sampling the temperature.
View Source
public override void StopUpdating()
VoltageToLuminance(Voltage)
Converts a voltage value to a level in centimeters, based on the current calibration values.
View Source
protected Illuminance VoltageToLuminance(Voltage voltage)
Returns
Meadow.Units.Illuminance
Parameters
Type | Name |
---|---|
Meadow.Units.Voltage | voltage |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
View Source
public void Dispose()
Dispose(bool)
Dispose of the object
View Source
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | Is disposing |
Implements
System.IObservable<Meadow.IChangeResult<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