private void ShowOnDisplay() { Display.clrscr(); Task.Delay(3).Wait(); string Temp = "Humidity: " + Humidity.ToString() + " %"; Display.prints(Temp); Temp = "Temperatur: " + Temperature.ToString() + " Grad"; Display.gotoSecondLine(); Display.prints(Temp); }
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. displayI2C lcd = new displayI2C(DEVICE_I2C_ADDRESS, I2C_CONTROLLER_NAME, RS, RW, EN, D4, D5, D6, D7, BL); //Initialization of HD44780 display do by init method. //By arguments you can turnOnDisplay, turnOnCursor, blinkCursor, cursorDirection and textShift (in thius order) 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 // 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("Current date,"); // Navigation to second line lcd.gotoxy(0, 1); // Here is printed string lcd.prints(System.DateTime.Now.ToString("MM/dd/yyyy h:mm tt")); // Here is printed our new symbol (emoticon) lcd.printSymbol(0x00); }
void inputKeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args) { switch (args.VirtualKey.ToString()) { case "Space": _lcd.prints(" "); break; case "Enter": _lcd.gotoSecondLine(); break; case "Back": _lcd.clrscr(); break; case "Control": if (this.backLight) { _lcd.turnOffBacklight(); } else { _lcd.turnOnBacklight(); } this.backLight = !this.backLight; break; case "Shift": //do nothing case "Menu": //do nothing break; case "Number1": _lcd.prints("1"); break; case "Number2": _lcd.prints("2"); break; case "Number3": _lcd.prints("3"); break; default: _lcd.prints(args.VirtualKey.ToString()); break; } }
private void start() { _lcd = new displayI2C(DEVICE_I2C_ADDRESS, I2C_CONTROLLER_NAME, RS, RW, EN, D4, D5, D6, D7, BL); _lcd.init(); _lcd.prints("Hello,"); }