Skip to main content

Class Ina260

Represents a INA260 Precision Digital Current and Power Monitor

Assembly: Ina260.dll
View Source
public class Ina260 : ByteCommsSensorBase<(Power? Power, Voltage? Voltage, Current? Current)>, IObservable<IChangeResult<(Power? Power, Voltage? Voltage, Current? Current)>>, ISamplingSensor<(Power? Power, Voltage? Voltage, Current? Current)>, ISensor<(Power? Power, Voltage? Voltage, Current? Current)>, ISensor, ISamplingSensor, IDisposable, II2cPeripheral

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

Implements:
System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Power>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Current>>>>, Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Power>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Current>>>, Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Power>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Current>>>, Meadow.Peripherals.Sensors.ISensor, Meadow.Peripherals.Sensors.ISamplingSensor, System.IDisposable, Meadow.Hardware.II2cPeripheral

Properties

DefaultI2cAddress

The default I2C address for the peripheral

View Source
public byte DefaultI2cAddress { get; }

Current

The value of the current (in Amps) flowing through the shunt resistor from the last reading

View Source
public Current? Current { get; }

Voltage

The voltage from the last reading..

View Source
public Voltage? Voltage { get; }

Power

The power from the last reading..

View Source
public Power? Power { get; }

ManufacturerID

Reads the unique manufacturer identification number

View Source
public int ManufacturerID { get; }

DieID

Reads the unique die identification number

View Source
public int DieID { get; }

Methods

ReadSensor()

Reads data from the sensor

View Source
protected override Task<(Power? Power, Voltage? Voltage, Current? Current)> ReadSensor()
Returns

System.Threading.Tasks.Task<System.ValueTuple<System.Nullable<Meadow.Units.Power>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Current>>>: The latest sensor reading### RaiseEventsAndNotify(IChangeResult<(Power? Power, Voltage? Voltage, Current? Current)>) Raise events for subscribers and notify of value changes

View Source
protected override void RaiseEventsAndNotify(IChangeResult<(Power? Power, Voltage? Voltage, Current? Current)> changeResult)
Parameters
TypeNameDescription
Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Power>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Current>>>changeResultThe updated sensor data

Events

PowerUpdated

Raised when the power value changes

View Source
public event EventHandler<IChangeResult<Power>> PowerUpdated
Event Type

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

VoltageUpdated

Raised when the voltage value changes

View Source
public event EventHandler<IChangeResult<Voltage>> VoltageUpdated
Event Type

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

CurrentUpdated

Raised when the current value changes

View Source
public event EventHandler<IChangeResult<Current>> CurrentUpdated
Event Type

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

Implements

  • System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Power>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Current>>>>
  • Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Power>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Current>>>
  • Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Power>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Current>>>
  • Meadow.Peripherals.Sensors.ISensor
  • Meadow.Peripherals.Sensors.ISamplingSensor
  • System.IDisposable
  • Meadow.Hardware.II2cPeripheral