Exemple #1
0
        static void HandleSpeedButtonRelease(GPIOPin pin, Edge edge)
        {
            try { Speed = Speeds[++SpeedIndex]; }
            catch
            {
                SpeedIndex = 0;
                Speed      = Speeds[SpeedIndex];
            }

            Console.WriteLine($"Speed changed to {Speed}");
            pin.WaitForEdge(edge, HandleSpeedButtonRelease);
        }
Exemple #2
0
        static void HandleModeButtonRelease(GPIOPin pin, Edge edge)
        {
            var newValue = Mode + 1;

            if (Enum.IsDefined(typeof(LedMode), newValue))
            {
                Mode = newValue;
            }
            else
            {
                Mode = LedMode.LTR;
            }
            Console.WriteLine($"Mode changed to {Mode}");
            pin.WaitForEdge(edge, HandleModeButtonRelease);
        }