/// <summary> /// LEDRGB Constructor. /// </summary> /// <param name="r">Red LED PWM channel</param> /// <param name="g">Green LED PWM channel</param> /// <param name="b">Blkue LED PWM channel</param> public LEDRGB(Cpu.PWMChannel r, Cpu.PWMChannel g, Cpu.PWMChannel b) { red = new PWM(r, 255, 0, PWM.ScaleFactor.Microseconds, false); green = new PWM(g, 255, 0, PWM.ScaleFactor.Microseconds, false); blue = new PWM(b, 255, 0, PWM.ScaleFactor.Microseconds, false); color = new RGBColor(0, 0, 0); }
/// <summary> /// Blink the led(s) using one color /// </summary> /// <param name="interval">time between and duration of blinks</param> /// <param name="reps">No. repetitions</param> /// <param name="color">Blink color</param> public void Blink(int interval, uint reps, RGBColor color) { reps *= 2; this.Color = color; blinktimer = new Timer(new TimerCallback((Object data) => { if (reps-- != 0) { if (this.State) { this.Off(); } else { this.On(); } } else { this.blinktimer.Dispose(); Off(); } }), null, 10, interval); }