Exemple #1
0
        private void Start()
        {
            // Here is I2C bus and Display itself initialized.
            //
            //  I2C bus is initialized by library constructor. There is also defined PCF8574 pins
            //  Default `DEVICE_I2C_ADDRESS` is `0x27` (you can change it by A0-2 pins on PCF8574 - for more info please read datasheet)
            //  `I2C_CONTROLLER_NAME` for Raspberry Pi 2 is `"I2C1"`
            //  For Arduino it should be `"I2C5"`, but I did't test it.
            //  Other arguments should be: RS = 0, RW = 1, EN = 2, D4 = 4, D5 = 5, D6 = 6, D7 = 7, BL = 3
            //  But it depends on your PCF8574.
            lcd = new DisplayI2C(DEVICE_I2C_ADDRESS, I2C_CONTROLLER_NAME, RS, RW, EN, D4, D5, D6, D7, BL);
            lcd.init();
            // Here is created new symbol
            // Take a look at data - it's smile emoticon
            // 0x00 => 00000
            // 0x00 => 00000
            // 0x0A => 01010
            // 0x00 => 00000
            // 0x11 => 10001
            // 0x0E => 01110
            // 0x00 => 00000
            // 0x00 => 00000

            String ip = GetIpAddressAsync();

            // data of symbol by lines                          //address of symbol
            //lcd.createSymbol(new byte[] { 0x00, 0x00, 0x0A, 0x00, 0x11, 0x0E, 0x00, 0x00 }, 0x00);

            // Here is printed string
            lcd.prints(ip);

            InitLedButtonSetup();
            SetupTempMeassurement();
            StartTestMeassurment();
        }
Exemple #2
0
        private void DisplayMessage(string message)
        {
            lcdDisplay.clrscr();
            if (!String.IsNullOrWhiteSpace(message))
            {
                if (message.Length < 17)
                {
                    lcdDisplay.prints(message);
                }
                else
                {
                    var msgPart = message.Substring(0, 16);//new String(message.Take(17).ToArray());
                    lcdDisplay.prints(msgPart);

                    msgPart = message.Substring(16);
                    lcdDisplay.gotoSecondLine();
                    lcdDisplay.prints(msgPart);
                }
            }
        }
Exemple #3
0
        private void ButtonPin_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs events)
        {
            lcd.gotoSecondLine();
            var text   = events.Edge.ToString();
            var length = text.Length;

            UpdateGui(text);

            if (length < 16)
            {
                text += new String(' ', 16 - length);
            }
            lcd.prints(text);
            if (events.Edge == GpioPinEdge.FallingEdge)
            {
                ToggleLed();
            }
        }