Main Site Documentation

G120 pwm



i have a question. How to use all PWM channels on G120?

The enumeration Cpu.PWMChannel doesnt contains the channel for pin P3.26. Enum ends on channel PWM_7.

RedLed = new PWM(Cpu.PWMChannel.PWM_6, _freq, 0.5, false); //RGB Led P3.24
GreenLed = new PWM(Cpu.PWMChannel.PWM_7, 0.5, false); //RGB Led P3.25
BlueLed = new PWM(???, _freq, 0.5, false); //RGB Led P3.26 

I used this as reference:


Welecome to forum.

You can code the pin number directly. Look at for guidence on calculating the pin number.

(Cpu.Pin)31 for pin 31


Thanks for quick answer,

but the PWM constructor needs type Cpu.PWMChannel.

The PWMChannel num 8 and higher aren’t defined in Microsoft.SPOT.Hardware;

This works: