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()); Microsoft.SPOT.Debug.Print("here"); Thread.Sleep(100); } }
private static bool SetupLCD() { if (_lcd == null) { try { //_lcd = new Lcd(new GpioLcdTransferProvider(Pins.GPIO_PIN_D13 // rs // , Pins.GPIO_PIN_D12 // enable // , Pins.GPIO_PIN_D8 // d4 // , Pins.GPIO_PIN_D9 // d5 // , Pins.GPIO_PIN_D10 // d6 // , Pins.GPIO_PIN_D11 // d7 // ) // , Pins.GPIO_NONE // Back light // ); var shifter = new BaseShifterLcdTransferProvider.ShifterSetup { RW = ShifterPin.GP1, // not used RS = ShifterPin.GP0, Enable = ShifterPin.GP2, D4 = ShifterPin.GP4, D5 = ShifterPin.GP5, D6 = ShifterPin.GP6, D7 = ShifterPin.GP7, BL = ShifterPin.GP3, }; _lcd = new Lcd(new MCP23008LcdTransferProvider(I2CBusExtension.GetSingleton(), 0x27, shifter)); _lcd.Initialize(16, 2); // LCD is now ready, let's test it! _lcd.BackLightDuration = Timeout.Infinite; _lcd.Backlight = true; _lcd.Clear(); _lcd.SetCursorPosition(0, 0); _lcd.Write("LCD Ready"); } catch (Exception ex) { DebugLogger.TryLog(Resources.GetString(Resources.StringResources.LCDError)); _lcd = null; } } return(_lcd != null); }
public static void Main() { Debug.Print("Application started OK."); Debug.Print("Initialising the display"); 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 }; Debug.Print("Shifter setup correctly."); var lcdBus = new Shifter74Hc595LcdTransferProvider(SPI.SPI_module.SPI1, Pins.GPIO_PIN_D3, Shifter74Hc595LcdTransferProvider.BitOrder.MSBFirst, setup); Debug.Print("LCD Bus created."); var lcd = new Lcd(lcdBus); Debug.Print("LCD Created"); lcd.Begin(16, 2); Debug.Print("Starting the application loop."); lcd.Write("Hello, world!"); int count = 0; while (true) { count++; Debug.Print("Pass: " + count.ToString()); lcd.SetCursorPosition(0, 1); lcd.Write((Utility.GetMachineTime().Ticks / 10000).ToString()); Thread.Sleep(100); } }