Skip to main content

Class Mcp960x

Represents a Mcp960x Thermocouple sensor object

Assembly: Mcp960x.dll
View Source
Declaration
public abstract class Mcp960x : ByteCommsSensorBase<(Temperature? TemperatureHot, Temperature? TemperatureCold)>, IObservable<IChangeResult<(Temperature? TemperatureHot, Temperature? TemperatureCold)>>, ISamplingSensor<(Temperature? TemperatureHot, Temperature? TemperatureCold)>, ISensor<(Temperature? TemperatureHot, Temperature? TemperatureCold)>, IDisposable, ITemperatureSensor, ISamplingSensor<Temperature>, ISensor<Temperature>, ISensor, ISamplingSensor, II2cPeripheral

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

Derived:
Meadow.Foundation.Sensors.Temperature.Mcp9600

Implements:

Expand

System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Temperature>>>>, Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Temperature>>>, Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Temperature>>>, System.IDisposable, 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, Meadow.Hardware.II2cPeripheral

Properties

DefaultI2cAddress

The default I2C address for the peripheral

View Source
Declaration
public byte DefaultI2cAddress { get; }

Temperature

The Hot Temperature value from the last reading

View Source
Declaration
public Temperature? Temperature { get; }

TemperatureHot

The Hot Temperature value from the last reading

View Source
Declaration
public Temperature? TemperatureHot { get; }

TemperatureCold

The Cold Temperature value from the last reading

View Source
Declaration
public Temperature? TemperatureCold { get; }

Methods

ReadSensor()

Update the Temperature property

View Source
Declaration
protected override Task<(Temperature? TemperatureHot, Temperature? TemperatureCold)> ReadSensor()
Returns

System.Threading.Tasks.Task<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Temperature>>>

SetThermocoupleType(ThermocoupleType)

Sets the thermocouple type for the MCP960x

View Source
Declaration
public void SetThermocoupleType(Mcp960x.ThermocoupleType type)
Parameters
TypeNameDescription
Meadow.Foundation.Sensors.Temperature.Mcp960x.ThermocoupleTypetypeThe thermocouple type to set

GetThermocoupleType()

Gets the thermocouple type currently configured for the MCP960x

View Source
Declaration
public Mcp960x.ThermocoupleType GetThermocoupleType()
Returns

Meadow.Foundation.Sensors.Temperature.Mcp960x.ThermocoupleType: The currently configured thermocouple type### SetAdcResolution(AdcResolution) Sets the ADC resolution for the MCP960x

View Source
Declaration
public void SetAdcResolution(Mcp960x.AdcResolution resolution)
Parameters
TypeNameDescription
Meadow.Foundation.Sensors.Temperature.Mcp960x.AdcResolutionresolutionThe ADC resolution to set

GetAdcResolution()

Gets the ADC resolution currently configured for the MCP960x

View Source
Declaration
public Mcp960x.AdcResolution GetAdcResolution()
Returns

Meadow.Foundation.Sensors.Temperature.Mcp960x.AdcResolution: The currently configured ADC resolution### SetFilterCoefficient(FilterCoefficient) Sets the filter coefficient for the MCP960x

View Source
Declaration
public void SetFilterCoefficient(Mcp960x.FilterCoefficient coefficient)
Parameters
TypeNameDescription
Meadow.Foundation.Sensors.Temperature.Mcp960x.FilterCoefficientcoefficientThe filter coefficient to set

GetFilterCoefficient()

Gets the filter coefficient for the MCP960x

View Source
Declaration
public Mcp960x.FilterCoefficient GetFilterCoefficient()
Returns

Meadow.Foundation.Sensors.Temperature.Mcp960x.FilterCoefficient: The currently configured filter coefficient### SetAlertTemperature(AlertNumber, Temperature) Sets the alert temperature for the specified alert number of the MCP960x

View Source
Declaration
public void SetAlertTemperature(Mcp960x.AlertNumber alertNumber, Temperature temperature)
Parameters
TypeNameDescription
Meadow.Foundation.Sensors.Temperature.Mcp960x.AlertNumberalertNumberThe alert number (1-4) to set the temperature for
Meadow.Units.TemperaturetemperatureThe temperature value

GetAlertTemperature(AlertNumber)

Gets the alert temperature for the specified alert number of the MCP960x

View Source
Declaration
public Temperature GetAlertTemperature(Mcp960x.AlertNumber alertNumber)
Returns

Meadow.Units.Temperature: The alert temperature value

Parameters
TypeNameDescription
Meadow.Foundation.Sensors.Temperature.Mcp960x.AlertNumberalertNumberThe alert number (1-4) to get the temperature for

ConfigureAlert(AlertNumber, bool, bool, bool, bool, bool)

Configures the alert settings for the MCP960x

View Source
Declaration
public void ConfigureAlert(Mcp960x.AlertNumber alertNumber, bool enabled, bool rising, bool alertColdJunction, bool activeHigh, bool interruptMode)
Parameters
TypeNameDescription
Meadow.Foundation.Sensors.Temperature.Mcp960x.AlertNumberalertNumberThe alert number (Alert1-Alert4) to configure
System.BooleanenabledWhether the alert is enabled
System.BooleanrisingWhether the alert triggers on a rising temperature. Set to false for falling temperature
System.BooleanalertColdJunctionWhether the alert triggers on cold junction temperature. Set to false for thermocouple temperature
System.BooleanactiveHighWhether the alert pin is active high. Set to false for active low
System.BooleaninterruptModeWhether the alert pin is in interrupt mode. Set to false for comparator mode

Enable(bool)

Enables or disables the MCP960x sensor

View Source
Declaration
public void Enable(bool enable)
Parameters
TypeNameDescription
System.BooleanenableTrue to enable the sensor, false to enter sleep mode

IsEnabled()

Checks whether the MCP960x sensor is enabled and working or in sleep mode

View Source
Declaration
public bool IsEnabled()
Returns

System.Boolean: True if in awake mode, false if in sleep mode### RaiseEventsAndNotify(IChangeResult<(Temperature? TemperatureHot, Temperature? TemperatureCold)>) Raise events for subscribers and notify of value changes

View Source
Declaration
protected override void RaiseEventsAndNotify(IChangeResult<(Temperature? TemperatureHot, Temperature? TemperatureCold)> changeResult)
Parameters
TypeNameDescription
Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Temperature>>>changeResultThe updated sensor data

Events

TemperatureHotUpdated

Raised when the Hot temperature value changes

View Source
Declaration
public event EventHandler<IChangeResult<Temperature>> TemperatureHotUpdated
Event Type

System.EventHandler<Meadow.IChangeResult<Meadow.Units.Temperature>>

TemperatureColdUpdated

Raised when the Cold / ambient temperature value changes

View Source
Declaration
public event EventHandler<IChangeResult<Temperature>> TemperatureColdUpdated
Event Type

System.EventHandler<Meadow.IChangeResult<Meadow.Units.Temperature>>

Implements

  • System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Temperature>>>>
  • Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Temperature>>>
  • Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Temperature>>>
  • System.IDisposable
  • 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
  • Meadow.Hardware.II2cPeripheral