LED-PWM example for a beginner?
Posted: Thu Dec 29, 2016 2:27 pm
Hi!
I've just started programming the ESP32 with IDF, and I am a complete beginner. I've managed to set up the tool chain and flash some examples. The next step I want to take is to control a motor with a PWM signal. It looks like the LED-PWM function of ESP32 is very versatile, but I am a bit overwhelmed with all the talk about clocks and dividers and high speed timers etc.
I'm looking for some example code that explains all the steps I need to take to get a PWM signal to a GPIO pin. I want the frequency of the signal to be around 20-25kHz (to avoid audible oscillations). I want to vary the duty cycle from 0% to 100%, the phase of the PWM signal is not important.
Is there someone who has some working code to share?
Thank you for your help in advance!
Jakob
I've just started programming the ESP32 with IDF, and I am a complete beginner. I've managed to set up the tool chain and flash some examples. The next step I want to take is to control a motor with a PWM signal. It looks like the LED-PWM function of ESP32 is very versatile, but I am a bit overwhelmed with all the talk about clocks and dividers and high speed timers etc.
I'm looking for some example code that explains all the steps I need to take to get a PWM signal to a GPIO pin. I want the frequency of the signal to be around 20-25kHz (to avoid audible oscillations). I want to vary the duty cycle from 0% to 100%, the phase of the PWM signal is not important.
Is there someone who has some working code to share?
Thank you for your help in advance!
Jakob