Remarks

C420T
Status Status badge: working
Source code GitHub
NuGet package NuGet 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

Characteristic Locus
Inheritance object > C420T
Implements IDisposable
Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString()
Namespace Meadow.Foundation.mikroBUS.Sensors
Assembly C420T.dll

Syntax

public class C420T : IDisposable

Constructors

C420T(ISpiBus, IDigitalOutputPort)

Creates a new C420T object using the SPI bus for output

Declaration
public C420T(ISpiBus spiBus, IDigitalOutputPort chipSelectPort)

Parameters

Type Name Description
ISpiBus spiBus

The SPI bus

IDigitalOutputPort chipSelectPort

Chip select port

Remarks

C420T
Status Status badge: working
Source code GitHub
NuGet package NuGet 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

C420T(ISpiBus, IPin)

Creates a new C420T object using the SPI bus for output

Declaration
public C420T(ISpiBus spiBus, IPin chipSelectPin)

Parameters

Type Name Description
ISpiBus spiBus

The SPI bus

IPin chipSelectPin

Chip select pin

Remarks

C420T
Status Status badge: working
Source code GitHub
NuGet package NuGet 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

Properties

IsDisposed

Represents a mikroBUS current sensing 4-20mA transmitter

Declaration
public bool IsDisposed { get; }

Property Value

Type Description
bool

Remarks

C420T
Status Status badge: working
Source code GitHub
NuGet package NuGet 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

ReferenceVoltage

Reference voltage (2.048V)

Declaration
public Voltage ReferenceVoltage { get; protected set; }

Property Value

Type Description
Voltage

Remarks

C420T
Status Status badge: working
Source code GitHub
NuGet package NuGet 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

Methods

Dispose()

Disposes resources

Declaration
public void Dispose()

Remarks

C420T
Status Status badge: working
Source code GitHub
NuGet package NuGet 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

Dispose(bool)

Disposes resources

Declaration
protected virtual void Dispose(bool disposing)

Parameters

Type Name Description
bool disposing

Remarks

C420T
Status Status badge: working
Source code GitHub
NuGet package NuGet 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

GenerateOutput(Current)

Generates a 4-20mA output

Declaration
public Task GenerateOutput(Current output)

Parameters

Type Name Description
Current output

The desired output current

Returns

Type Description
Task

Remarks

C420T
Status Status badge: working
Source code GitHub
NuGet package NuGet 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