מיקרופייתון – PWM

 

 

 

The maximum PWM frequency is 40 MHz. However, due to the timer frequency of the ESP32 (80 MHz), you only get the full 10 bit resolution up to the following PWM frequency:

�max, full res=80000000210=78125[Hz]

For larger frequencies, you can calculate the actual resolution as follows:

res=80000000�

For example, if you choose 20 MHz as frequency, you only have a resolution of 4, i.e. you can set the duty cycles 0, 25, 50 and 75% by passing values in the ranges 0-255, 256-511, 512-767 or 768-1023 to pwm.duty().

כתיבת תגובה