public static void ApiDemoDisplay(ILiquidCrystal lc, int x, int y, string text, bool clear = true, int waitTime = 1000)
        {
            if (clear)
            {
                lc.Clear();
            }

            if (text.Length > lc.NumCols)
            {
                var p = lc.NumCols - 1;
                while (p > 0 & text[p] != ' ')
                {
                    p--;
                }

                if (p == 0)
                {
                    p = lc.NumCols - 1;
                }

                lc.Print(x, y, text.Substring(0, p));
                lc.Print(x, y + 1, text.Substring(p).TrimStart());
            }
            else
            {
                lc.Print(x, y, text);
            }

            if (waitTime > 0)
            {
                TimePeriod.Sleep(waitTime);
            }
        }
 public static void ProgressBarDemo(ILiquidCrystal lc)
 {
     lc.Clear();
     lc.Print(0, 0, "Working hard...");
     for (var p = 0; p <= 100; p += 10)
     {
         lc.ProgressBar(0, 1, 10, p, string.Format("{0}% ", p.ToString("000")));
         TimePeriod.Sleep(150);
         if (Console.KeyAvailable)
         {
             lc.Clear();
             return;
         }
     }
     TimePeriod.Sleep(1000);
     lc.Clear();
 }
        public static void NusbioRocks(ILiquidCrystal lc, int wait = 180)
        {
            var autoScrollDemoText1 = "Nusbio for .NET          rocks or what?";

            lc.Clear();
            lc.Autoscroll();
            lc.SetCursor(lc.NumCols, 0);
            try {
                foreach (var c in autoScrollDemoText1)
                {
                    lc.Print(c.ToString());
                    TimePeriod.Sleep(wait);
                    if (Console.KeyAvailable)
                    {
                        return;
                    }
                }
                TimePeriod.Sleep(1000);
            }
            finally{
                lc.NoAutoscroll();
                lc.Clear();
            }
        }
        public static void CustomCharDemo(ILiquidCrystal lc)
        {
            var smiley = new List <string>()
            {
                "B00000",
                "B10001",
                "B00000",
                "B00000",
                "B10001",
                "B01110",
                "B00000",
                "B00000",
            };

            lc.CreateChar(0, BitUtil.ParseBinary(smiley).ToArray());
            lc.Clear();
            lc.Write(0);
            lc.Write(0xF4);
            lc.Write(0xFF);
            lc.Write(0xFF);
        }
 public static void NusbioRocksOrWhat(ILiquidCrystal lc)
 {
     lc.Clear();
     lc.Print(-1, 0, "Nusbio for .NET");
     lc.Print(-1, 1, "rocks or what!");
 }