void UpdateColor(Color color)
        {
            _color = color;

            // set the color based on the RGB values
            RedPwm.DutyCycle   = (_color.R * _maximumRedPwmDuty);
            GreenPwm.DutyCycle = (_color.G * _maximumGreenPwmDuty);
            BluePwm.DutyCycle  = (_color.B * _maximumBluePwmDuty);

            if (IsCommonCathode == false)
            {
                RedPwm.DutyCycle   = 1 - RedPwm.DutyCycle;
                GreenPwm.DutyCycle = 1 - GreenPwm.DutyCycle;
                BluePwm.DutyCycle  = 1 - BluePwm.DutyCycle;
            }

            // start our PWMs.
            RedPwm.Start();
            GreenPwm.Start();
            BluePwm.Start();
        }
Exemple #2
0
 /// <summary>
 /// Turns on the LED
 /// </summary>
 public void TurnOn()
 {
     RedPwm.Start();
     GreenPwm.Start();
     BluePwm.Start();
 }
Exemple #3
0
 /// <summary>
 /// Turns off the LED
 /// </summary>
 public void TurnOff()
 {
     RedPwm.Stop();
     GreenPwm.Stop();
     BluePwm.Stop();
 }