ESP8266 PWM Signal frequency

Hi,

Greetings!

I have just started development on ESP8266 platform using arduino.
I am trying to generate PWM signal (50% duty cycle) in range of 20KHz to 50KHz.

Till now I am able to generate 20KHz only.
Please note that I have tried with analogWrite, ticker and timer1.

Kindly suggest me proper method to generate PWM signal of desired frequency.

Regards,

Dinesh

Hi,

Greetings!

I have just started development on ESP8266 platform using arduino.
I am trying to generate PWM signal (50% duty cycle) in range of 20KHz to 50KHz.

Till now I am able to generate 20KHz only.
Please note that I have tried with analogWrite, ticker and timer1.

Kindly suggest me proper method to generate PWM signal of desired frequency.

Regards,

Dinesh

I am trying to generate PWM signal (50% duty cycle) in range of 20KHz to 50KHz.

50%? Try tone();

Or

Try the Timer1 library.

Example:
https://github.com/PaulStoffregen/TimerOne/blob/master/examples/FanSpeed/FanSpeed.pde

Exactly. But look at analogWriteFreq() for the ESP8266.

@dinesh4761, do not cross-post. Threads merged.

dinesh4761:
I am trying to generate PWM signal (50% duty cycle)

If the duty cycle is always 50% then it is not a "PWM" signal. PWM is short for "Pulse Width Modulated". If the duty cycle is always 50% then there is no modulation. What you meant to say was "FM", Frequency Modulated.