Returns the period of a pin in PWM or PTPG mode
This method provides the actual period in seconds of a Pulse-Width Modulation or Pin-Triggered Pulse Generator output pin. The exact meaning of ‘period’ differs between PWM and PTPG — see pin.configure() for details.
The returned result can vary slightly from the value supplied to pin.configure(), due to hardware limitations. Typically, the returned value has been rounded to a whole number of clock cycles.
A Squirrel runtime error occurs if this call is made to a pin that is not currently configured in either PWM or PTPG mode.
pin.getperiod() provides the period 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.