示例#1
0
 /// <summary>
 /// This method will use I2C commands to talk to the display. The display is expected to be at address 0x27 and accept 4 bit commands.
 /// This runs a full test suite against the display.
 /// </summary>
 static void UsingHd44780OverI2C()
 {
     using (I2cDevice i2CDevice = I2cDevice.Create(new I2cConnectionSettings(1, 0x27)))
     {
         LcdInterface lcdInterface = LcdInterface.CreateI2c(i2CDevice, false);
         using (Hd44780 hd44780 = new Lcd2004(lcdInterface))
         {
             hd44780.UnderlineCursorVisible = false;
             hd44780.BacklightOn            = true;
             hd44780.DisplayOn = true;
             hd44780.Clear();
             ExtendedSample.Test(hd44780);
         }
     }
 }
        /// <summary>
        /// This method will use I2C commands to talk to the display. The display is expected to be at address 0x27 and accept 4 bit commands.
        /// This runs a full test suite against the display.
        /// </summary>
        private static void UsingHd44780OverI2C()
        {
            using (I2cDevice i2CDevice = I2cDevice.Create(new I2cConnectionSettings(1, 0x27)))
            {
                LcdInterface lcdInterface = LcdInterface.CreateI2c(i2CDevice, false);
                using (Hd44780 hd44780 = new Lcd2004(lcdInterface))
                {
                    hd44780.UnderlineCursorVisible = false;
                    hd44780.BacklightOn            = true;
                    hd44780.DisplayOn = true;
                    hd44780.Clear();
                    Console.WriteLine("Display initialized. Press Enter to start tests.");
                    Console.ReadLine();

                    LcdConsoleSamples.WriteTest(hd44780);
                    ExtendedSample.Test(hd44780);
                }
            }
        }