Main Content

Raspberry Pi PWM

The Raspberry Pi® hardware board supports software pulse-width modulation (PWM) on all GPIO pins. When configured for PWM, each pin outputs a square waveform with variable frequency and duty cycle.

The minimum PWM output frequency is 10 Hz. The maximum PWM output frequency is 8 KHz using writePWMFrequency(mypi, 12, 8000).

A duty cycle of 0 means that the waveform is always low. A duty cycle of 1 means the waveform is always high.

To use a PWM pin, configure the GPIO pin as a PWM pin using the configurePin function.

To see the available GPIO pins on raspberrpi object, use the showPins function.


See Also

| |