コード例 #1
0
        private static void ShowInfo(LcdController lcd, string label, string value)
        {
            lcd.Clear();
            lcd.SetCursor(0, 0);
            lcd.Print(label);

            lcd.SetCursor(0, 1);
            lcd.Print(value);

            Thread.Sleep(TimeSpan.FromSeconds(3));
        }
コード例 #2
0
        private static void Lcd(GpioDriver driver)
        {
            const int registerSelectPinNumber = 0;
            const int enablePinNumber         = 5;

            int[] dataPinNumbers = { 6, 16, 20, 21 };

            using (var controller = new GpioController(driver))
            {
                GpioPin   registerSelectPin = controller.OpenPin(registerSelectPinNumber);
                GpioPin   enablePin         = controller.OpenPin(enablePinNumber);
                GpioPin[] dataPins          = controller.OpenPins(dataPinNumbers);

                var lcd = new LcdController(registerSelectPin, enablePin, dataPins);
                lcd.Begin(16, 2);
                lcd.Print("hello, world!");

                Stopwatch watch = Stopwatch.StartNew();

                while (watch.Elapsed.TotalSeconds < 15)
                {
                    lcd.SetCursor(0, 1);
                    lcd.Print($"{watch.Elapsed.TotalSeconds:0.00} seconds");
                }
            }
        }