class PWM
- pulse width modulation¶
Usage:
from ezblock import PWM
pwm = PWM('P0') # create an pwm object from a pin
pwm.freq(50) # set freq 50Hz
pwm.prescaler(2) # set prescaler
pwm.period(100) # set period
pwm.pulse_width(10) # set pulse_width
pwm.pulse_width_percent(50) # set pulse_width_percent
Constructors¶
class ezblock.PWM(channel)
Create an PWM object associated with the given pin. This allows you set up the pwm function on that pin.
Methods¶
freq - set the pwm channel freq.
PWM.freq(50)
prescaler - set the pwm channel prescaler.
PWM.prescaler(50)
period - set the pwm channel period.
PWM.period(100)
pulse_width - set the pwm channel pulse_width.
PWM.pulse_width(10)
pulse_width_percent - set the pwm channel pulse_width_percent.
PWM.pulse_width_percent(50)