/** Creates RGB LEDStripController for Port 3 of HERO) */ public LEDStripController(CTRE.HERO.Port3Definition port3) { /* Duration of pulse */ uint duration = 0; //Gadgeteer Drive Module //PIN J2 isPWM //3 P1 //4 P2 Y //5 P3 //6 P4 Y Red //7 P5 Y Green //8 P6 Y Blue //9 --- Y /* PWM Pin 6 from Hero port 3 to P4 of Driver Module */ _pwms[0] = new PWM(port3.PWM_Pin6, period, duration, PWM.ScaleFactor.Microseconds, false); /* PWM Pin 7 from Hero port 3 to P5 of Driver Module */ _pwms[1] = new PWM(port3.PWM_Pin7, period, duration, PWM.ScaleFactor.Microseconds, false); /* PWM Pin 8 from Hero port 3 to P6 of Driver Module */ _pwms[2] = new PWM(port3.PWM_Pin8, period, duration, PWM.ScaleFactor.Microseconds, false); /* Start all PWM Pins */ foreach (PWM pwm in _pwms) { pwm.Start(); } }
const uint period = 2000; //period between pulses public LEDStripController(CTRE.HERO.Port3Definition port3) { uint duration = 0; //duration of pulse //Gadgeteer Drive Module //PIN J2 isPWM //3 P1 //4 P2 Y //5 P3 //6 P4 Y Red //7 P5 Y Grn //8 P6 Y Blu //9 --- Y _pwms[0] = new PWM(port3.PWM_Pin6, period, duration, PWM.ScaleFactor.Microseconds, false); // p4 _pwms[1] = new PWM(port3.PWM_Pin7, period, duration, PWM.ScaleFactor.Microseconds, false); // p5 _pwms[2] = new PWM(port3.PWM_Pin8, period, duration, PWM.ScaleFactor.Microseconds, false); // p6 foreach (PWM pwm in _pwms) { pwm.Start(); } }