Remarks

Sh1106
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Displays.Sh1106

Code Example

MicroGraphics graphics;

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

    var sh1106 = new Sh1106
    (
        spiBus: Device.CreateSpiBus(),
        chipSelectPin: Device.Pins.D02,
        dcPin: Device.Pins.D01,
        resetPin: Device.Pins.D00
    );

    graphics = new MicroGraphics(sh1106);
    graphics.CurrentFont = new Font8x8();
    graphics.Rotation = RotationType._180Degrees;

    return base.Initialize();
}

public override Task Run()
{
    graphics.Clear();
    graphics.DrawRectangle(0, 0, 128, 64, false);
    graphics.DrawTriangle(10, 10, 50, 50, 10, 50, false);
    graphics.DrawRectangle(20, 15, 40, 20, true);
    graphics.DrawText(5, 5, "SH1106");
    graphics.Show();

    return base.Run();
}

Sample project(s) available on GitHub

Characteristic Locus
Inheritance object Sh110x > Sh1106
Implements IGraphicsDisplay ISpiPeripheral II2cPeripheral IDisposable
Inherited Members Sh110x.ColorMode Sh110x.SupportedColorModes Sh110x.Width Sh110x.Height Sh110x.DefaultSpiBusSpeed Sh110x.SpiBusSpeed Sh110x.DefaultSpiBusMode Sh110x.SpiBusMode Sh110x.DefaultI2cAddress Sh110x.connectionType Sh110x.PixelBuffer Sh110x.IsDisposed Sh110x.i2cComms Sh110x.spiComms Sh110x.commandBuffer Sh110x.SetDisplayOffset(byte) Sh110x.InvertDisplay(bool) Sh110x.PowerSaveMode() Sh110x.Reset() Sh110x.SetContrast(byte) Sh110x.Show() Sh110x.Show(int, int, int, int) Sh110x.Clear(bool) Sh110x.DrawPixel(int, int, Color) Sh110x.DrawPixel(int, int, bool) Sh110x.InvertPixel(int, int) Sh110x.StartScrolling(Sh110x.ScrollDirection) Sh110x.StartScrolling(Sh110x.ScrollDirection, byte, byte) Sh110x.StopScrolling() Sh110x.Fill(Color, bool) Sh110x.Fill(int, int, int, int, Color) Sh110x.WriteBuffer(int, int, IPixelBuffer) Sh110x.Dispose() Sh110x.Dispose(bool) object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString()
Namespace Meadow.Foundation.Displays
Assembly Sh110x.dll

Syntax

public class Sh1106 : Sh110x, IGraphicsDisplay, ISpiPeripheral, II2cPeripheral, IDisposable

Constructors

Sh1106(II2cBus, byte, int, int)

Create a new Sh1106 object

Declaration
public Sh1106(II2cBus i2cBus, byte address, int width, int height)

Parameters

Type Name Description
II2cBus i2cBus

I2C bus connected to display

byte address

I2C address

int width

Display width in pixels

int height

Display height in pixels

Remarks

Sh1106
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Displays.Sh1106

Code Example

MicroGraphics graphics;

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

    var sh1106 = new Sh1106
    (
        spiBus: Device.CreateSpiBus(),
        chipSelectPin: Device.Pins.D02,
        dcPin: Device.Pins.D01,
        resetPin: Device.Pins.D00
    );

    graphics = new MicroGraphics(sh1106);
    graphics.CurrentFont = new Font8x8();
    graphics.Rotation = RotationType._180Degrees;

    return base.Initialize();
}

public override Task Run()
{
    graphics.Clear();
    graphics.DrawRectangle(0, 0, 128, 64, false);
    graphics.DrawTriangle(10, 10, 50, 50, 10, 50, false);
    graphics.DrawRectangle(20, 15, 40, 20, true);
    graphics.DrawText(5, 5, "SH1106");
    graphics.Show();

    return base.Run();
}

Sample project(s) available on GitHub

Sh1106(ISpiBus, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, int, int)

Create a new Sh1106 display object

Declaration
public Sh1106(ISpiBus spiBus, IDigitalOutputPort chipSelectPort, IDigitalOutputPort dataCommandPort, IDigitalOutputPort resetPort, int width = 128, int height = 64)

Parameters

Type Name Description
ISpiBus spiBus

SPI bus connected to display

IDigitalOutputPort chipSelectPort

Chip select output port

IDigitalOutputPort dataCommandPort

Data command output port

IDigitalOutputPort resetPort

Reset output port

int width

Display width in pixels

int height

Display height in pixels

Remarks

Sh1106
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Displays.Sh1106

Code Example

MicroGraphics graphics;

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

    var sh1106 = new Sh1106
    (
        spiBus: Device.CreateSpiBus(),
        chipSelectPin: Device.Pins.D02,
        dcPin: Device.Pins.D01,
        resetPin: Device.Pins.D00
    );

    graphics = new MicroGraphics(sh1106);
    graphics.CurrentFont = new Font8x8();
    graphics.Rotation = RotationType._180Degrees;

    return base.Initialize();
}

public override Task Run()
{
    graphics.Clear();
    graphics.DrawRectangle(0, 0, 128, 64, false);
    graphics.DrawTriangle(10, 10, 50, 50, 10, 50, false);
    graphics.DrawRectangle(20, 15, 40, 20, true);
    graphics.DrawText(5, 5, "SH1106");
    graphics.Show();

    return base.Run();
}

Sample project(s) available on GitHub

Sh1106(ISpiBus, IPin, IPin, IPin, int, int)

Create a new Sh1106 object

Declaration
public Sh1106(ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin, int width = 128, int height = 64)

Parameters

Type Name Description
ISpiBus spiBus

SPI bus connected to display

IPin chipSelectPin

Chip select pin

IPin dcPin

Data command pin

IPin resetPin

Reset pin

int width

Display width in pixels

int height

Display height in pixels

Remarks

Sh1106
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Displays.Sh1106

Code Example

MicroGraphics graphics;

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

    var sh1106 = new Sh1106
    (
        spiBus: Device.CreateSpiBus(),
        chipSelectPin: Device.Pins.D02,
        dcPin: Device.Pins.D01,
        resetPin: Device.Pins.D00
    );

    graphics = new MicroGraphics(sh1106);
    graphics.CurrentFont = new Font8x8();
    graphics.Rotation = RotationType._180Degrees;

    return base.Initialize();
}

public override Task Run()
{
    graphics.Clear();
    graphics.DrawRectangle(0, 0, 128, 64, false);
    graphics.DrawTriangle(10, 10, 50, 50, 10, 50, false);
    graphics.DrawRectangle(20, 15, 40, 20, true);
    graphics.DrawText(5, 5, "SH1106");
    graphics.Show();

    return base.Run();
}

Sample project(s) available on GitHub

Methods

Initialize()

Initialize the Sh1106

Declaration
protected override void Initialize()

Overrides

Remarks

Sh1106
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Displays.Sh1106

Code Example

MicroGraphics graphics;

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

    var sh1106 = new Sh1106
    (
        spiBus: Device.CreateSpiBus(),
        chipSelectPin: Device.Pins.D02,
        dcPin: Device.Pins.D01,
        resetPin: Device.Pins.D00
    );

    graphics = new MicroGraphics(sh1106);
    graphics.CurrentFont = new Font8x8();
    graphics.Rotation = RotationType._180Degrees;

    return base.Initialize();
}

public override Task Run()
{
    graphics.Clear();
    graphics.DrawRectangle(0, 0, 128, 64, false);
    graphics.DrawTriangle(10, 10, 50, 50, 10, 50, false);
    graphics.DrawRectangle(20, 15, 40, 20, true);
    graphics.DrawText(5, 5, "SH1106");
    graphics.Show();

    return base.Run();
}

Sample project(s) available on GitHub