Skip to main content

Class AnalogSolarIntensityGauge

Driver to measure solar panel input

Assembly: AnalogSolarIntensityGauge.dll
View Source
Declaration
public class AnalogSolarIntensityGauge : SamplingSensorBase<float>, IObservable<IChangeResult<float>>, ISamplingSensor<float>, ISamplingSensor, ISolarIntensityGauge, ISensor<float>, ISensor, IDisposable

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

Implements:
System.IObservable<Meadow.IChangeResult<System.Single>>, Meadow.Peripherals.Sensors.ISamplingSensor<System.Single>, Meadow.Peripherals.Sensors.ISamplingSensor, Meadow.Peripherals.Sensors.Light.ISolarIntensityGauge, Meadow.Peripherals.Sensors.ISensor<System.Single>, Meadow.Peripherals.Sensors.ISensor, System.IDisposable

Properties

MinVoltageReference

Minimum voltage reference

View Source
Declaration
public Voltage MinVoltageReference { get; protected set; }

MaxVoltageReference

Maximum voltage reference

View Source
Declaration
public Voltage MaxVoltageReference { get; protected set; }

SolarIntensity

Gets percentage of solar intensity, from 0 to 1.0, with 1.0 being the MaxVoltageReference, and 0 being the MinVoltageReference.

View Source
Declaration
public float? SolarIntensity { get; protected set; }

IsDisposed

Is the object disposed

View Source
Declaration
public bool IsDisposed { get; }

Methods

Initialize()

Initialize the sensor

View Source
Declaration
protected void Initialize()

ReadSensor()

Reads data from the sensor

View Source
Declaration
protected override Task<float> ReadSensor()
Returns

System.Threading.Tasks.Task<System.Single>: The latest sensor reading### StartUpdating(TimeSpan?) Starts continuously sampling the sensor

This method also starts raising SolarIntensityUpdated events and IObservable subscribers getting notified. Use the readIntervalDuration parameter to specify how often events and notifications are raised/sent.

View Source
Declaration
public override void StartUpdating(TimeSpan? updateInterval)
Parameters
TypeNameDescription
System.Nullable<System.TimeSpan>updateIntervalA TimeSpan that specifies how long to
 wait between readings. This value influences how often `*Updated`
events are raised and `IObservable` consumers are notified. |

StopUpdating()

Stops sampling the solar intensity

View Source
Declaration
public override void StopUpdating()

ConvertVoltageToIntensity(Voltage)

Converts a voltage reading to a solar intensity percentage, taking into account the minimum and maximum expected values.

View Source
Declaration
protected float ConvertVoltageToIntensity(Voltage voltage)
Returns

System.Single: 0.0 - 1.0

Parameters
TypeName
Meadow.Units.Voltagevoltage

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

View Source
Declaration
public void Dispose()

Dispose(bool)

Dispose of the object

View Source
Declaration
protected virtual void Dispose(bool disposing)
Parameters
TypeNameDescription
System.BooleandisposingIs disposing

Implements

  • System.IObservable<Meadow.IChangeResult<System.Single>>
  • Meadow.Peripherals.Sensors.ISamplingSensor<System.Single>
  • Meadow.Peripherals.Sensors.ISamplingSensor
  • Meadow.Peripherals.Sensors.Light.ISolarIntensityGauge
  • Meadow.Peripherals.Sensors.ISensor<System.Single>
  • Meadow.Peripherals.Sensors.ISensor
  • System.IDisposable