How to set PWM bit resolution using Zerynth?

Hi, I’m a newbie in using Zerynth :smiley:
Recently, I’m trying to program my ESP32 DEVKIT V1 to control PWM signal through my circuit. But I feel confused when I tried to set the bit-resolution of my PWM signal.

In Arduino IDE, the bit-resolution can be set using the following code:

ledcSetup(ledChannel, freq, resolution); 
ledcWrite(ledChannel, dutyCycle);
#if I set the resolution to be 8-bit, then the duty cycle would be around 0-255

Meanwhile, the code that could be used in Zerynth to program PWM signal was:


If I want to set the PWM to be 8-bit as well, how to do it? If I change “100” to “255” in that code, would I get 8-bit resolution? Thanks :slight_smile:

Hi @ghani_faliq
The resolution is set in the vhal pack in the PWM driver for ESP32 devices as 15 bits.
you can change that if needed, normally its a trade-off between resolution and range.
the 15 bit resolution is not suitable for your application ?