Ejemplo n.º 1
0
            public void DisplayTemperature(float value)
            {
                char   degree = System.Convert.ToChar(223);
                string temp   = value.ToString("N2");
                string text   = ("Temp: " + temp + degree + "C");

                _lcd.WriteLine(text, 0);
            }
Ejemplo n.º 2
0
            protected void StartTestCharDisplay()
            {
                System.Threading.Thread t = new Thread(() =>
                {
                    ushort start         = 0;
                    ushort end           = 255;
                    ushort current       = start;
                    ushort count         = _lcd.DisplayConfig.Width;
                    ushort calculatedEnd = 0;

                    while (true)
                    {
                        Debug.Print("Loop");
                        calculatedEnd = (ushort)(current + count);

                        // if we're passed the end, start at the beginning
                        if (current >= end)
                        {
                            current       = start;
                            calculatedEnd = calculatedEnd = (ushort)(current + count);
                        }
                        // if we're near the end, only display up to 255
                        else if (current + count > end)
                        {
                            ushort surplus = (ushort)(current + count - end);
                            calculatedEnd  = (ushort)(end - surplus);
                        }

                        _lcd.Clear();
                        _lcd.WriteLine("chars " + current.ToString() + "-" + calculatedEnd.ToString(), 0);
                        DisplayChars(current, calculatedEnd);

                        current += count;

                        Thread.Sleep(500);
                    }
                });
                t.Start();
            }