Пример #1
0
 private static void DisplayTime(LiquidCrystal lc)
 {
     lc.Print(0, 0, DateTime.Now.ToString("d"));
     lc.Print(0, 1, DateTime.Now.ToString("T"));
 }
Пример #2
0
 private static void ProgressBarDemo(LiquidCrystal 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();
 }
Пример #3
0
 private static void NusbioRocks(LiquidCrystal lc)
 {
     var autoScrollDemoText1 = "Nusbio for .NET          rocks or what?";
     lc.Clear();
     lc.Autoscroll();
     lc.SetCursor(15, 0);
     try { 
         foreach (var c in autoScrollDemoText1)
         {
             lc.Print(c.ToString());
             TimePeriod.Sleep(180);
             if (Console.KeyAvailable)
                 return;
         }
         TimePeriod.Sleep(1000);
     }
     finally{
         lc.NoAutoscroll();
         lc.Clear();
     }
 }
Пример #4
0
        private static void ApiDemoDisplay(LiquidCrystal lc, int x, int y, string text, bool clear = true, int waitTime = 1000) {

            if(clear)
                lc.Clear();

            if(text.Length > 16) {

                var p = 15;
                while (p > 0 & text[p] != ' ')
                {
                    p--;
                }

                if(p==0)
                    p = 15;

                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);
        }