Skip to main content

Class AnalogTemperature

Provide the ability to read the temperature from the following sensors:

  • TMP35 / 36 / 37
  • LM35 / 45
Assembly: Meadow.Foundation.dll​
View Source​
Declaration
public class AnalogTemperature : SamplingSensorBase<Temperature>, IObservable<IChangeResult<Temperature>>, ITemperatureSensor, ISamplingSensor<Temperature>, ISensor<Temperature>, ISensor, ISamplingSensor, IDisposable

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

Implements:
System.IObservable<Meadow.IChangeResult<Meadow.Units.Temperature>>, Meadow.Peripherals.Sensors.ITemperatureSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Temperature>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Temperature>, Meadow.Peripherals.Sensors.ISensor, Meadow.Peripherals.Sensors.ISamplingSensor, System.IDisposable

Properties​

AnalogInputPort​

View Source​
Declaration
protected IAnalogInputPort AnalogInputPort { get; }

SensorCalibration​

View Source​
Declaration
public AnalogTemperature.Calibration SensorCalibration { get; set; }

Temperature​

Current Temperature

View Source​
Declaration
public Temperature? Temperature { get; protected set; }

IsDisposed​

Is the object disposed

View Source​
Declaration
public bool IsDisposed { get; }

Methods​

ReadSensor()​

Convenience method to get the current temperature. For frequent reads, use StartSampling() and StopSampling() in conjunction with the SampleBuffer.

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

System.Threading.Tasks.Task<Meadow.Units.Temperature>: The temperature averages of the given sample count### 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​
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 temperature

View Source​
Declaration
public override void StopUpdating()

VoltageToTemperature(Voltage)​

Converts voltage to Temperature

View Source​
Declaration
protected Temperature VoltageToTemperature(Voltage voltage)
Returns​

Meadow.Units.Temperature: Temperature

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<Meadow.Units.Temperature>>
  • Meadow.Peripherals.Sensors.ITemperatureSensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Temperature>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Temperature>
  • Meadow.Peripherals.Sensors.ISensor
  • Meadow.Peripherals.Sensors.ISamplingSensor
  • System.IDisposable