Beispiel #1
0
        void TestPwmLed()
        {
            Console.WriteLine("TestPwmLed...");

            while (true)
            {
                Console.WriteLine("Turning on and off each led for one second");
                pwmLed.IsOn = true;
                Thread.Sleep(500);
                pwmLed.IsOn = false;

                Console.WriteLine("Blinking the LED for three seconds...");
                pwmLed.StartBlink();
                Thread.Sleep(3000);
                pwmLed.Stop();

                Console.WriteLine("Pulsing the LED for three seconds...");
                pwmLed.StartPulse();
                Thread.Sleep(3000);
                pwmLed.Stop();

                Console.WriteLine("Increasing and decreasing brightness...");
                for (int j = 0; j <= 3; j++)
                {
                    for (int i = 0; i <= 10; i++)
                    {
                        pwmLed.SetBrightness(i * 0.10f);
                        Thread.Sleep(100);
                    }

                    for (int i = 10; i >= 0; i--)
                    {
                        pwmLed.SetBrightness(i * 0.10f);
                        Thread.Sleep(100);
                    }
                }
            }
        }
Beispiel #2
0
 public void BrightnessTest(int loopCount)
 {
     for (int i = 0; i < loopCount; i++)
     {
         Console.WriteLine("Blue On @ 1.0");
         _bluePwmLed.SetBrightness(1);
         Thread.Sleep(1000);
         Console.WriteLine("Blue at 98.5%");
         _bluePwmLed.SetBrightness(0.985f);
         Thread.Sleep(1000);
         Console.WriteLine("Blue Off");
         _bluePwmLed.SetBrightness(0);
         Thread.Sleep(1000);
         Console.WriteLine("Blue 50%");
         _bluePwmLed.SetBrightness(0.5f);
         Thread.Sleep(1000);
         _bluePwmLed.Stop();
     }
 }