Meadow.Foundation.Sensors.Temperature.Pct2075
Pct2075 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
private Pct2075 sensor;
public override Task Initialize()
{
sensor = new Pct2075(Device.CreateI2cBus());
sensor.Updated += OnUpdated;
return Task.CompletedTask;
}
public override Task Run()
{
sensor.StartUpdating(TimeSpan.FromSeconds(1));
return Task.CompletedTask;
}
private void OnUpdated(object sender, IChangeResult<Meadow.Units.Temperature> e)
{
Resolver.Log.Info($"Temp: {e.New.Celsius:n1}C {e.New.Fahrenheit:n1}F");
}
Sample project(s) available on GitHub
Class Pct2075
Represents a PCT2075 temperature sensor
Assembly: Pct2075.dll
View Source
public class Pct2075 : PollingSensorBase<Temperature>, IObservable<IChangeResult<Temperature>>, ITemperatureSensor, ISamplingSensor<Temperature>, ISensor<Temperature>, ISensor, ISamplingSensor, II2cPeripheral
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
, Meadow.Hardware.II2cPeripheral
Properties
Temperature
Last value read from the Temperature sensor.
View Source
public Temperature? Temperature { get; }
DefaultI2cAddress
The default I2C address for the peripheral
View Source
public byte DefaultI2cAddress { get; }
Methods
ReadSensor()
Read value from sensor
View Source
protected override Task<Temperature> ReadSensor()
Returns
System.Threading.Tasks.Task<Meadow.Units.Temperature>
: unitized value### SetInterruptTemperatures(Temperature, Temperature, bool)
Sets the interrupt temperatures for the PCT2075 sensor.
View Source
public void SetInterruptTemperatures(Temperature interruptOnTemperature, Temperature interruptOffTemperature, bool interruptActiveHigh = true)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Units.Temperature | interruptOnTemperature | The temperature threshold that triggers the interrupt. |
Meadow.Units.Temperature | interruptOffTemperature | The temperature threshold that deactivates the interrupt. |
System.Boolean | interruptActiveHigh | Indicates whether the interrupt is active-high (true) or active-low (false). |
Default is active-high. |
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
Meadow.Hardware.II2cPeripheral