Skip to main content

LCD Display Sample

LCD Display

This sample demonstrates how to control an LCD using the Adafruit I2C/SPI LCD backpack.

LCD Backpack

Code

The application producing the above output is as follows:

using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
using MicroLiquidCrystal;

namespace HelloWorld
{
public class Program
{
public static void Main()
{
var setup = new BaseShifterLcdTransferProvider.ShifterSetup()
{
BL = ShifterPin.GP7,
RS = ShifterPin.GP1,
RW = ShifterPin.None,
Enable = ShifterPin.GP2,
D4 = ShifterPin.GP6,
D5 = ShifterPin.GP5,
D6 = ShifterPin.GP4,
D7 = ShifterPin.GP3
};
var lcdBus = new Shifter74Hc595LcdTransferProvider(SPI.SPI_module.SPI1, Pins.GPIO_PIN_D3,
Shifter74Hc595LcdTransferProvider.BitOrder.MSBFirst, setup);
var lcd = new Lcd(lcdBus);
lcd.Begin(16, 2);
lcd.Write("Hello, world!");
while (true)
{
lcd.SetCursorPosition(0, 1);
lcd.Write((Utility.GetMachineTime().Ticks / 10000).ToString());
Thread.Sleep(100);
}
}
}
}

Hardware

Connect the LCD to the Netduino as follows:

Discussion

A full discussion on SPI and the software can be found on the Wilderness Labs SPI Pages:

Hardware Required

Netduino Samples Github Repository

Full source code for all of the samples can be found in the Netduino Samples repository on Github.