Skip to main content

Meadow.Foundation.Displays.Led.FourDigitSevenSegment

FourDigitSevenSegment
StatusStatus badge: working
Source codeGitHub
NuGet packageNuGet Gallery for Meadow.Foundation.Displays.Led.FourDigitSevenSegment

Code Example

FourDigitSevenSegment sevenSegment;

public override Task Initialize()
{
Resolver.Log.Info("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:

SevenSegmentMeadow Pin
portED11
portDD10
PortDecimalD09
PortCD08
PortGD07
PortD4D06
PortBD05
PortD3D04
PortD2D03
PortFD02
PortAD01
PortD1D00

It should look like the following diagram:

Wiring Example

Wiring a SevenSegment to a Meadow F7

Class FourDigitSevenSegment

Four Digit Seven Segment Display

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

Implements:
System.IDisposable

Properties

IsDisposed

Is the object disposed

View Source
Declaration
public bool IsDisposed { get; }

Methods

SetDisplay(string, int)

Displays the specified characters

View Source
Declaration
public void SetDisplay(string characters, int decimalLocation = -1)
Parameters
TypeNameDescription
System.StringcharactersThe characters to display
System.Int32decimalLocationThe decimal position (0 indexed)

SetDisplay(char[], int)

Displays the specified characters

View Source
Declaration
public void SetDisplay(char[] characters, int decimalLocation = -1)
Parameters
TypeNameDescription
System.Char[]charactersThe characters to display
System.Int32decimalLocationThe decimal position (0 indexed)

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

View Source
Declaration
public void Dispose()

Dispose(bool)

Dispose of the object

View Source
Declaration
protected virtual void Dispose(bool disposing)
Parameters
TypeNameDescription
System.BooleandisposingIs disposing

Implements

  • System.IDisposable