DOIT ESP32 PWM example not working


Hi all, I am new to Zerynth and wonder if anyone can give me a hint what is going on with the PWM example.
I tried the blink example on a DOIT ESP32 board and that works fine, but when trying to use the PWM example, nothing happens.
My Zerynth version is r2.2.0 Patch p0.


You can try that example, This would run without errors.

import pwm


pinMode(LED0,OUTPUT) # set the LED pin as output:

while True:
    for i in range(-100,100,1):   # create a loop for ranging the duty cycle from 0 to 100 MICROS
        pwm.write(LED0.PWM,100,duty,MILLIS)     # set the pwm at the calculated duty with a fixed period of 100 MICROS
        sleep(10) # update the PWM every 10 millis


Thanks for your reply.
This is the one I used, but the LED stays off


The code I attached uses lower frequency for PWM.
Try the attached code and let me know how it goes.:smile:


I got it to work on the DOIT board. I didn’t change anything and it started to behave as expected.
I have now created a virtual machine for my own board based on the ESP32 Wroom module and the same thing happens there.
The Led I connected works fine when using an IO as output, but as soon as I use it as PWM with the same example, nothing. I checked the output with a scope and the output is always at low level.

I think I will go back to the native Espressif environment to see if that works.


Tested my own board using the native Espressif IDE and all is fine.
So I suspect there is a problem with the virtual environment created for my own board.
I’ll go back to programming in C