public static void Main() { SerialLCD _display = new SerialLCD(); // define our character maps. // see http://maxpromer.github.io/LCD-Character-Creator/ for // a GUI character maker byte[] happyFace = { 0x0, 0x0, 0xa, 0x0, 0x11, 0xe, 0x0, 0x0 }; byte[] sadFace = { 0x0, 0x0, 0xa, 0x0, 0xe, 0x11, 0x0, 0x0 }; byte[] rocket = { 0x4, 0xa, 0xa, 0xa, 0x11, 0x15, 0xa, 0x0 }; byte[] heart = { 0x0, 0xa, 0x1f, 0x1f, 0xe, 0x4, 0x0, 0x0 }; // save the custom characters _display.SaveCustomCharacter(happyFace, 1); _display.SaveCustomCharacter(sadFace, 2); _display.SaveCustomCharacter(rocket, 3); _display.SaveCustomCharacter(heart, 4); _display.Clear(); _display.SetBrightness(); // create our string, using the addresses of the characters // casted to char. StringBuilder s = new StringBuilder(); s.Append("1:" + (char)1 + " "); s.Append("2:" + (char)2 + " "); s.Append("3:" + (char)3 + " "); s.Append("4:" + (char)4 + " "); _display.WriteLine(s.ToString(), 0); Thread.Sleep(Timeout.Infinite); }
public static void Main() { SerialLCD _display = new SerialLCD(); // set to 100% brightness in case it got stuck in a strange state _display.SetBrightness(1); _display.WriteLine("Hello, line 2.", 1); while (true) { float bValue = 0f; // loop through 0 - 100% brightness for (int i = 0; i <= 100; i++) { bValue = (float)i / (float)100; _display.WriteLine("Brightness: " + i.ToString() + "%", 0); Debug.Print("Brightness: " + i.ToString() + "%"); _display.SetBrightness(bValue); } } }
// counts from 1-100 and displays it in a scrolling manner on a display public static void Main() { SerialLCD _lcd = new SerialLCD(new TextDisplayConfig { Height = 4, Width = 20 }); _lcd.SetBrightness(); while (true) { // count to 100 for (int i = 1; i <= (100 - _lcd.DisplayConfig.Height + 1); i++) { // write to all lines for (byte l = 0; l < _lcd.DisplayConfig.Height; l++) { _lcd.WriteLine((i + l).ToString(), l); } Thread.Sleep(250); } } }
private void RPMsChanged(object sender, Sensors.SensorFloatEventArgs e) { Debug.Print("RPMs: " + e.CurrentValue); _lcd.WriteLine("Speed: " + e.CurrentValue.ToString("N0") + "RPMs", 1); }