Skip to main content

Meadow.Foundation.Sensors.Power.CurrentTransducer

CurrentTransducer
StatusStatus badge: working
Source codeGitHub
NuGet packageNuGet Gallery for Meadow.Foundation.Sensors.Power.CurrentTransducer

Code Example

private CurrentTransducer transducer = default!;

public override Task Initialize()
{
Resolver.Log.Info("Initialize...");

var bus = Device.CreateI2cBus();
transducer = new CurrentTransducer(
Device.Pins.A00.CreateAnalogInputPort(1),
new Voltage(3.3, Voltage.UnitType.Volts), // a reading of 3.3V
new Current(10, Current.UnitType.Amps) // equals 10 amps of current
);

Resolver.Log.Info($"-- Current Transducer Sample App ---");
transducer.Updated += (s, v) =>
{
Resolver.Log.Info($"Current is now {v.New.Amps}A");
};

return Task.CompletedTask;
}

public override Task Run()
{
transducer.StartUpdating(TimeSpan.FromSeconds(2));
return Task.CompletedTask;
}

Sample project(s) available on GitHub