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() { var display = new SerialLCD(); // // Clear the display ready for the test. // display.Clear(); display.SetCursorStyle(SerialLCD.CursorStyle.BlinkingBoxOff); display.SetCursorStyle(SerialLCD.CursorStyle.UnderlineOff); // // Display some text on the bottom row of a 16x2 LCD. // display.SetCursorPosition(2, 1); display.DisplayText("Hello, world"); Thread.Sleep(1000); // // Now scroll the text off of the display to the left. // for (int index = 0; index < 16; index++) { display.ScrollDisplay(SerialLCD.Direction.Left); Thread.Sleep(500); } // // Put some text on the top line of the display (note that the // text is still off to the left of the display). // display.SetCursorPosition(0, 0); display.DisplayText("Scrolling Right"); Thread.Sleep(500); // // Now scroll the text back on to the display from the left to // the right of the display. // for (int index = 0; index < 16; index++) { display.ScrollDisplay(SerialLCD.Direction.Right); Thread.Sleep(500); } // // Now put a cursor on the display and move it around. // display.SetCursorStyle(SerialLCD.CursorStyle.BlinkingBoxOn); for (int index = 0; index < 10; index++) { display.MoveCursor(SerialLCD.Direction.Left); Thread.Sleep(200); } Thread.Sleep(1000); display.SetCursorStyle(SerialLCD.CursorStyle.BlinkingBoxOff); // // Done. // Thread.Sleep(Timeout.Infinite); }
public static void Main() { var display = new SerialLCD(); // // Clear the display ready for the test. // display.Clear(); display.SetCursorStyle(SerialLCD.CursorStyle.BlinkingBoxOff); display.SetCursorStyle(SerialLCD.CursorStyle.UnderlineOff); // // Display some text on the bottom row of a 16x2 LCD. // display.SetCursorPosition(1, 1); display.Write("Hello, world"); Thread.Sleep(1000); }