Function | definition |
---|---|
pwm.start() | Start pwm function at assigned gpio pin |
pwm.stop() | Stop pwm |
Plaese refer: “GPIO Table” for detail.
Description
Start pwm function at assigned gpio pin.
Syntax
pwm.start(pin, freq, duty)
Parameters
pin: gpio pin ID. There are 11 PWM ports supported in WiFiMCU: D1, D3, D4, D9, D10, D11, D12, D13, D14, D15, D16.
freq: PWM output frequency in Hz, 0<freq<10KHz
duty: Duty of PWM output, must be 0<=duty <=100
Returns
nil.
Examples
i=1;pin=1;
tmr.start(1,1000,function()
i=i+10;if i>=100 then i=1 end
pwm.start(pin,10000,i)
end)
-
Description
Stop pwm.
Syntax
pwm.stop(pin)
Parameters
pin: gpio pin ID. There are 11 PWM ports supported in WiFiMCU: D1, D3, D4, D9, D10, D11, D12, D13, D14, D15, D16.
Returns
nil.
Examples
-pwm.stop(1)