Adafruit RGB LCD Shield

Shield connections

The shield is connected to pins A4 and A5. All data is transferred over I²C.

Sample code in C#

// The Adafruit LCD Shield uses a MCP23017 IC as multiplex chip
Mcp23017 Mux = new Mcp23017();

// Pins 0 to 4 on the Mux-chip are connected to the buttons
IGPIPort ButtonSelect = Mux.Pins[0];
IGPIPort ButtonRight = Mux.Pins[1];
IGPIPort ButtonDown = Mux.Pins[2];
IGPIPort ButtonUp = Mux.Pins[3];
IGPIPort ButtonLeft = Mux.Pins[4];
// Enables pull-ups for all the buttons
for (int i = 0; i < 5; ++i)
{
    Mux.EnablePullup(i, true);
    Mux.Pins[i].InvertReadings = true;
}

// Pins 6 to 8 on the Mux-chip are for the backlight
Mux.Pins[6].Write(false); // Red backlight
Mux.Pins[7].Write(true);  // Green backlight
Mux.Pins[8].Write(true);  // Blue backlight

// Pins 9 to 15 are connected to the HD44780 LCD
Hd44780Lcd Display = new Hd44780Lcd(
    Data: Mux.CreateParallelOut(9, 4),
    ClockEnablePin: Mux.Pins[13],
    ReadWritePin: Mux.Pins[14],
    RegisterSelectPin: Mux.Pins[15]
);

Display.ClearDisplay();
Display.Write("Hello World!");

Sample code in VB

' The Adafruit LCD Shield uses a MCP23017 IC as multiplex chip
Dim Mux As Mcp23017 = New Mcp23017()

' Pins 0 to 4 on the Mux-chip are connected to the buttons
Dim ButtonSelect As IGPIPort = Mux.Pins(0)
Dim ButtonRight As IGPIPort = Mux.Pins(1)
Dim ButtonDown As IGPIPort = Mux.Pins(2)
Dim ButtonUp As IGPIPort = Mux.Pins(3)
Dim ButtonLeft As IGPIPort = Mux.Pins(4)
' Enables pull-ups for all the buttons
For i As Integer = 0 To 4
    Mux.EnablePullup(i, True)
    Mux.Pins(i).InvertReadings = True
Next

' Pins 6 to 8 on the Mux-chip are for the backlight
Mux.Pins(6).Write(False)  ' Red backlight
Mux.Pins(7).Write(True)   ' Green backlight
Mux.Pins(8).Write(True)   ' Blue backlight

' Pins 9 to 15 are connected to the HD44780 LCD
Dim Display As Hd44780Lcd = New Hd44780Lcd(
                            Data:=Mux.CreateParallelOut(9, 4),
                            ClockEnablePin:=Mux.Pins(13),
                            ReadWritePin:=Mux.Pins(14),
                            RegisterSelectPin:=Mux.Pins(15)
)

Display.ClearDisplay()
Display.Write("Hello World!")

Last edited Jul 15, 2012 at 7:42 PM by Garrcomm, version 2