A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By eriksl
#22916 Probably, but this forum doesn't allow you to edit posts...

Read carefully, I said Espressif implemented it different now. There is no hardware support for PWM. You will have to implement it in software one way or another. Their first implementation was limited to 8 bits, now the resolution is variable.
User avatar
By tytower
#22939 Eh ? Each post has two icons top right . Click on first and a sub menu comes up ,choose "edit post" . Go back to first post and you can edit the title if you wish.

On PWM each declared PWM pin can produce a pulse at a rate selected by you based on a scale of 0 to 1023 , being 0 to 100% power on as I understand it . It is based on a 10 bit register in the ESP but maybe I have this wrong?.
The wiki has
"
PWM analogWrite(pin, value) enables software PWM on the given pin. PWM may be used on pins 0 to 15. Call analogWrite(pin, 0) to disable PWM on the pin. value may be in range from 0 to 1023. 0 to 255 is normal on an arduino board as its an 8bit ADC but ESP8266 is 10 bit so 1023 is full duty cycle.


"software PWM" is what I don't understand . Can you explain that for me . Does the pulse get calculated by the ADC and transfered to the selected pin?

Also please follow the link to the new topic (two problems solved in one go...)

I didn't see a link ?

BTW I am not having a shot at you . I use PWM to drive motors on my solar tracking device and am trying to convert it to wifi from my phone so my interest is piqued.
User avatar
By eriksl
#22941 Normally I don't see any useful options onder the left icon, other than "report" but now it seems I may change my first post. Wow.

Your quoting the wikipedia that is based on an older SDK.

I repeat, the ESP8266 does NOT have any hardware for PWM. The old SDK had a more limited software implementation than the current one. Nothing more nothing less.

It's not really that difficult to implement a software PWM, I've done it myself. Just program the interrupt of a fast enough timer to go when the next PWM GPIO should flip and when the interrupt fires, flip the GPIO and calculate the time to the next PWM GPIO in clock ticks, and program the timer interrupt compare register for that. That's why multiple PWM's can't have duty cycles that are very close together, in the time the compare register is programmed, the timer already reached that point.