Skip to main content

Class SwitchingAnemometer

Driver for a "switching" anemometer (wind speed gauge) that has an internal switch that is triggered during every revolution.

Assembly: SwitchingAnemometer.dll
View Source
Declaration
public class SwitchingAnemometer : PollingSensorBase<Speed>, IObservable<IChangeResult<Speed>>, IAnemometer, ISamplingSensor<Speed>, ISensor<Speed>, ISensor, ISamplingSensor, IDisposable

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

Implements:
System.IObservable<Meadow.IChangeResult<Meadow.Units.Speed>>, Meadow.Peripherals.Sensors.Weather.IAnemometer, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Speed>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Speed>, Meadow.Peripherals.Sensors.ISensor, Meadow.Peripherals.Sensors.ISamplingSensor, System.IDisposable

Properties

WindSpeed

The current wind speed

View Source
Declaration
public Speed? WindSpeed { get; protected set; }

NoWindTimeout

Time to wait if no events come in to register a zero speed wind

View Source
Declaration
public TimeSpan NoWindTimeout { get; set; }

OneTimeReadDuration

Time to capture samples for a one time Read if IsSampling is false

View Source
Declaration
public TimeSpan OneTimeReadDuration { get; set; }

SampleCount

Number of samples to take for a reading

View Source
Declaration
public int SampleCount { get; set; }

KmhPerSwitchPerSecond

Calibration for how fast the wind speed is when the switch is hit once per second. Used to calculate the wind speed based on the time duration between switch events. Default is 2.4kmh.

View Source
Declaration
public float KmhPerSwitchPerSecond { get; set; }

IsDisposed

Is the object disposed

View Source
Declaration
public bool IsDisposed { get; }

Methods

StartUpdating(TimeSpan?)

Starts continuously sampling the sensor

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

View Source
Declaration
public override void StartUpdating(TimeSpan? updateInterval = null)
Parameters
TypeName
System.Nullable<System.TimeSpan>updateInterval

StopUpdating()

Stops the driver from raising wind speed events

View Source
Declaration
public override void StopUpdating()

ReadSensor()

Reads data from the sensor

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

System.Threading.Tasks.Task<Meadow.Units.Speed>: The latest sensor reading### SwitchIntervalToKmh(TimeSpan) A wind speed of 2.4km/h causes the switch to close once per second

View Source
Declaration
protected float SwitchIntervalToKmh(TimeSpan interval)
Returns

System.Single

Parameters
TypeNameDescription
System.TimeSpanintervalThe interval between signals

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<Meadow.Units.Speed>>
  • Meadow.Peripherals.Sensors.Weather.IAnemometer
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Speed>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Speed>
  • Meadow.Peripherals.Sensors.ISensor
  • Meadow.Peripherals.Sensors.ISamplingSensor
  • System.IDisposable