Main Site Documentation

Cerbuino PWM


Just a quick question.

I found out, that the LED on the Cerbuino is on B2 and I can successfully toogle it. Now I want to try out PWM, but it seems PWM is not possible on this Pin.

Is it possible to use any Pin with a “Software PWM”, i.e. the PWM class. If Yes, how can I use IO Pins to generate SOftware PWM?

I also saw SignalGenerator which allows me to do something similar, but it seems, that it is not possible to change the duty cycle on the fly.

Does the Set method immediatly change the Pin state, or does it wait until the next timing?

e.g. if I start SIgnalGenerator with a pin state of false and execute this command after 600ms:
signal.Set(false, new uint[] { 500 * 1000, 500*1000});

Does it set the Pin back to false immediatly, or does it wait until the 500ms were passed?

0ms = false
500ms = true
1000ms = false


0ms = false
500ms = true
600ms = false
1100ms = true


@ Alex111 - The PWM class in Microsoft.SPOT.Hardware is not software PWM, it uses the native hardware on the device.

For SignalGenerator, the pin is set to false when you construct the object. 600ms later you run the set command. It starts at false. Since the pin was already false no change occurs. 500ms later it sets to true, then 500ms later again it sets it back to false.


OK THanks.

Is Software PWM available except using the SignalGenerator? e.g. another PWM class?


@ Alex111 - We do not offer a software PWM class and NETMF does not have one either.


I asked because “Software PWM” is mentioned in the GHI docs. But SignalGenerator is great, too…



@ Alex111 - The document also mentions “Software PWM is performed using the SignalGenerator class.”


Yes thanks for help. I now understand the relation.