Characteristic Locus
Inheritance object ObservableBase<Voltage> SamplingSensorBase<Voltage> > AnalogSamplingBase > Temt6000
Implements IObservable<IChangeResult<Voltage>> ISamplingSensor<Voltage> ISensor<Voltage>
Inherited Members SamplingSensorBase<Voltage>.samplingLock SamplingSensorBase<Voltage>.Updated SamplingSensorBase<Voltage>.SamplingTokenSource SamplingSensorBase<Voltage>.Conditions SamplingSensorBase<Voltage>.IsSampling SamplingSensorBase<Voltage>.UpdateInterval SamplingSensorBase<Voltage>.RaiseEventsAndNotify(IChangeResult<Voltage>) SamplingSensorBase<Voltage>.Read() ObservableBase<Voltage>.observers ObservableBase<Voltage>.NotifyObservers(IChangeResult<Voltage>) ObservableBase<Voltage>.Subscribe(IObserver<IChangeResult<Voltage>>) ObservableBase<Voltage>.CreateObserver(Action<IChangeResult<Voltage>>, Predicate<IChangeResult<Voltage>>) object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString()
Namespace Meadow.Foundation.Sensors.Base
Assembly Meadow.Foundation.dll

Syntax

public abstract class AnalogSamplingBase : SamplingSensorBase<Voltage>, IObservable<IChangeResult<Voltage>>, ISamplingSensor<Voltage>, ISensor<Voltage>

Constructors

AnalogSamplingBase(IAnalogInputPort)

Creates a new AnalogObservableBase driver

Declaration
public AnalogSamplingBase(IAnalogInputPort port)

Parameters

Type Name Description
IAnalogInputPort port

analog input port

AnalogSamplingBase(IPin, int, TimeSpan?, Voltage?)

Creates a new AnalogObservableBase driver

Declaration
public AnalogSamplingBase(IPin pin, int sampleCount = 5, TimeSpan? sampleInterval = null, Voltage? voltage = null)

Parameters

Type Name Description
IPin pin

AnalogChannel connected to the sensor.

int sampleCount

Number of sample to average for a reading

TimeSpan? sampleInterval

Time between intervals

Voltage? voltage

Max voltage of analog port

Properties

Voltage

Current voltage

Declaration
public Voltage Voltage { get; protected set; }

Property Value

Type Description
Voltage

Methods

ReadSensor()

Convenience method to get the current voltage

Declaration
protected override Task<Voltage> ReadSensor()

Returns

Type Description
Task<Voltage>

A float value that represents the current voltage

Overrides

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.

Declaration
public override void StartUpdating(TimeSpan? updateInterval)

Parameters

Type Name Description
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.

Overrides

StopUpdating()

Stops sampling the sensor

Declaration
public override void StopUpdating()

Overrides