Skip to main content

pin.getdutycycle()

Returns the specified PWM output pin’s current duty cycle

Availability

Device (from impOS™ 38)

Returns

Float — the duty cycle as a value between 0.0 and 1.0

Description

This method provides the actual pulse-width modulation duty cycle as a value between 0.0 and 1.0. This is the case even if the PWM is running in ‘zombie’ mode, ie. it continues to operate across Squirrel reloads, firmware upgrades and device restarts.

Note The imp005 only supports PWM on GPIO pins from impOS™ 36 and up.