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 of0
means that the waveform is always low. A duty cycle of1
means the waveform is always high.
To use a PWM pin, configure the GPIO pin as a PWM pin using theconfigurePin
function.
To see the available GPIO pins onraspberrpi
object, use theshowPins
function.
showPins(mypi)