Returns the period of a pin in PWM or PTPG mode
Float — the PTPG or PWM period in seconds
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.
An exception will be thrown 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.