Skip to main content

Meadow.Foundation.mikroBUS.Sensors.C420T

C420T
StatusStatus badge: working
Source codeGitHub
NuGet packageNuGet Gallery for Meadow.Foundation.mikroBUS.Sensors.C420T

Code Example

private C420T transmitter;

public override Task Initialize()
{
Console.WriteLine("Initializing ...");

transmitter = new C420T(Device.CreateSpiBus(), Device.Pins.D00);

return Task.CompletedTask;
}

public override async Task Run()
{
var ma = 4;
var direction = 1;

while (true)
{
ma += direction;
if (ma == 20)
{
direction = -1;
}
else if (ma == 4)
{
direction = 1;
}

var val = new Meadow.Units.Current(ma, Meadow.Units.Current.UnitType.Milliamps);

Resolver.Log.Info($"Writing: {val.Milliamps:0.00} mA");
transmitter?.GenerateOutput(val);

await Task.Delay(1000);
}
}

Sample project(s) available on GitHub

Class C420T

Represents a mikroBUS current sensing 4-20mA transmitter

Assembly: C420T.dll
View Source
Declaration
public class C420T : IDisposable

Implements:
System.IDisposable

Properties

ReferenceVoltage

Reference voltage (2.048V)

View Source
Declaration
public Voltage ReferenceVoltage { get; protected set; }

IsDisposed

Gets a value indicating whether the object has been disposed

View Source
Declaration
public bool IsDisposed { get; }

Methods

GenerateOutput(Current)

Generates a 4-20mA output

View Source
Declaration
public Task GenerateOutput(Current output)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
Meadow.Units.CurrentoutputThe desired output current

Dispose(bool)

Disposes resources

View Source
Declaration
protected virtual void Dispose(bool disposing)
Parameters
TypeName
System.Booleandisposing

Dispose()

Disposes resources

View Source
Declaration
public void Dispose()

Implements

  • System.IDisposable