Remarks

FourDigitSevenSegment
Status Status badge: working
Source code GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Displays.Led.FourDigitSevenSegment

Code Example

FourDigitSevenSegment sevenSegment;

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

    sevenSegment = new FourDigitSevenSegment
    (
        portDigit1: Device.CreateDigitalOutputPort(Device.Pins.D00),
        portDigit2: Device.CreateDigitalOutputPort(Device.Pins.D03),
        portDigit3: Device.CreateDigitalOutputPort(Device.Pins.D04),
        portDigit4: Device.CreateDigitalOutputPort(Device.Pins.D06),
        portA: Device.CreateDigitalOutputPort(Device.Pins.D01),
        portB: Device.CreateDigitalOutputPort(Device.Pins.D05),
        portC: Device.CreateDigitalOutputPort(Device.Pins.D08),
        portD: Device.CreateDigitalOutputPort(Device.Pins.D10),
        portE: Device.CreateDigitalOutputPort(Device.Pins.D11),
        portF: Device.CreateDigitalOutputPort(Device.Pins.D02),
        portG: Device.CreateDigitalOutputPort(Device.Pins.D07),
        portDecimal: Device.CreateDigitalOutputPort(Device.Pins.D09),
        isCommonCathode: true
    );

    return base.Initialize();
}

public override Task Run()
{
    sevenSegment.SetDisplay("1234");

    return base.Run();
}

Sample project(s) available on GitHub

Wiring Example

To wire a Common Cathode Seven Segment Display (like the 5161AS) to your Meadow board, connect the following:

SevenSegment Meadow Pin
portE D11
portD D10
PortDecimal D09
PortC D08
PortG D07
PortD4 D06
PortB D05
PortD3 D04
PortD2 D03
PortF D02
PortA D01
PortD1 D00

It should look like the following diagram:

Characteristic Locus
Inheritance System.Object > FourDigitSevenSegment
Namespace Meadow.Foundation.Displays.Led
Assembly FourDigitSevenSegment.dll

Syntax

public class FourDigitSevenSegment : object

Constructors

FourDigitSevenSegment(IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, Boolean)

Creates a SevenSegment connected to the especified IDigitalOutputPorts

Declaration
public FourDigitSevenSegment(IDigitalOutputPort portDigit1, IDigitalOutputPort portDigit2, IDigitalOutputPort portDigit3, IDigitalOutputPort portDigit4, IDigitalOutputPort portA, IDigitalOutputPort portB, IDigitalOutputPort portC, IDigitalOutputPort portD, IDigitalOutputPort portE, IDigitalOutputPort portF, IDigitalOutputPort portG, IDigitalOutputPort portDecimal, bool isCommonCathode)

Parameters

Type Name Description
IDigitalOutputPort portDigit1

Port for digit 1

IDigitalOutputPort portDigit2

Port for digit 2

IDigitalOutputPort portDigit3

Port for digit 3

IDigitalOutputPort portDigit4

Port for digit 4

IDigitalOutputPort portA

Port for pin A

IDigitalOutputPort portB

Port for pin B

IDigitalOutputPort portC

Port for pin C

IDigitalOutputPort portD

Port for pin D

IDigitalOutputPort portE

Port for pin E

IDigitalOutputPort portF

Port for pin F

IDigitalOutputPort portG

Port for pin G

IDigitalOutputPort portDecimal

Port for decimal pin

System.Boolean isCommonCathode

Is the display common cathode (true)

FourDigitSevenSegment(IMeadowDevice, IPin, IPin, IPin, IPin, IPin, IPin, IPin, IPin, IPin, IPin, IPin, IPin, Boolean)

Creates a SevenSegment connected to the especified IPins to a IODevice

Declaration
public FourDigitSevenSegment(IMeadowDevice device, IPin pinDigit1, IPin pinDigit2, IPin pinDigit3, IPin pinDigit4, IPin pinA, IPin pinB, IPin pinC, IPin pinD, IPin pinE, IPin pinF, IPin pinG, IPin pinDecimal, bool isCommonCathode)

Parameters

Type Name Description
IMeadowDevice device

The device connected to the display

IPin pinDigit1

Digit 1 pin

IPin pinDigit2

Digit 2 pin

IPin pinDigit3

Digit 3 pin

IPin pinDigit4

Digit 4 pin

IPin pinA

A pin

IPin pinB

B pin

IPin pinC

C pin

IPin pinD

D pin

IPin pinE

E pin

IPin pinF

F pin

IPin pinG

G pin

IPin pinDecimal

Decimal pin

System.Boolean isCommonCathode

Is the display common cathode (true)

Methods

SetDisplay(Char[], Int32)

Displays the specified characters

Declaration
public void SetDisplay(char[] characters, int decimalLocation = null)

Parameters

Type Name Description
System.Char[] characters

The chracters to display

System.Int32 decimalLocation

The decimal position (0 indexed)

SetDisplay(String, Int32)

Displays the specified characters

Declaration
public void SetDisplay(string characters, int decimalLocation = null)

Parameters

Type Name Description
System.String characters

The chracters to display

System.Int32 decimalLocation

The decimal position (0 indexed)