Skip to main content

Meadow.Foundation.Sensors.Temperature.Pct2075

Pct2075
StatusStatus badge: working
Source codeGitHub
Datasheet(s)GitHub
NuGet packageNuGet Gallery for Meadow.Foundation.Sensors.Temperature.Pct2075

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
Declaration
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
Declaration
public Temperature? Temperature { get; }

DefaultI2cAddress

The default I2C address for the peripheral

View Source
Declaration
public byte DefaultI2cAddress { get; }

Methods

ReadSensor()

Read value from sensor

View Source
Declaration
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
Declaration
public void SetInterruptTemperatures(Temperature interruptOnTemperature, Temperature interruptOffTemperature, bool interruptActiveHigh = true)
Parameters
TypeNameDescription
Meadow.Units.TemperatureinterruptOnTemperatureThe temperature threshold that triggers the interrupt.
Meadow.Units.TemperatureinterruptOffTemperatureThe temperature threshold that deactivates the interrupt.
System.BooleaninterruptActiveHighIndicates 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