Left here for archival purposes.

User avatar
By draco
#13005 This weekend, I was trying to 'fade' an LED from fully off to fully on by slowly increasing the duty cycle. After about the sixth call to pwm.setduty(), the module reboots.

The results were the same across different firmwares (build 20150213 and 20130318) and module types (ESP-03 and ESP-12). Changing the pin used had no effect, nor did changing the step size -- no matter what step size used, I could only change it about six times before the module rebooted.

I think this code will demonstrate the problem. I am replicating it from memory since I'm at work and don't have my ESP modules with me.
Code: Select alllocal pin=8
pwm.setup(pin, 1000, 0)
pwm.start(pin)

for i=0,1000,100 do
  pwm.setduty(pin,i)
  tmr.delay(500000)
end

I tried doing a pwm.stop() and pwm.start() before and after the setduty calls, made no difference. I tried doing a full pwm.setup() call instead of pwm.setduty(), made no difference.
Last edited by draco on Tue Mar 31, 2015 5:10 am, edited 1 time in total.