public void TestMethod1() { using (Lcd1602 lcd = new Lcd1602(new I2CMock("/dev/i2c-1", 0x27))) //0x27 address of LCD { Console.WriteLine("Init"); lcd.Init(); Console.WriteLine("Clear"); lcd.Clear(); Console.WriteLine("Hello"); lcd.Write(0, 0, "Hello"); Console.WriteLine("World!"); lcd.Write(0, 1, "World!"); } }
static void Test1602() { using (Lcd1602 lcd = new Lcd1602(new I2C("/dev/i2c-1", 0x27))) //0x27 address of LCD { lcd.Init(); lcd.Clear(); var screenWidth = 16; var message = "Hello Krysia, how are you today?"; var text = message.PadLeft(message.Length + screenWidth).PadRight(message.Length + 2 * screenWidth); for (var i = 0; i < text.Length - screenWidth + 1; i++) { lcd.Write(0, 0, text.Substring(i, screenWidth)); Thread.Sleep(250); } } }