public void blinkLed() { Console.WriteLine("Creating Outputs..."); var pwmRedLed = new PwmLed(Device, Device.Pins.D13, TypicalForwardVoltage.Red); var pwmBlueLed = new PwmLed(Device, Device.Pins.D12, TypicalForwardVoltage.Blue); pwmRedLed.StartBlink(10, 10); pwmBlueLed.StartBlink(10, 10); Thread.Sleep(Timeout.Infinite); }
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); } } } }