espruino / EspruinoDocs

See http://espruino.com for the complete Espruino Documentation - many links in this repository will not work
http://www.espruino.com/
Other
253 stars 282 forks source link

tutorials/Software PWM.md #711

Closed IntellijouleIncorp closed 6 months ago

IntellijouleIncorp commented 6 months ago

What is the maximum repetition rate for the PWM output? A 100KHZ to 1 MHZ output range for the PWM would make the puck.js2 more valuable.

gfwilliams commented 6 months ago

Using hardware PWM on Puck.js the counter frequency is 16Mhz, and you can get a max frequency of 4Mhz (but only with a 2 bit resolution). So for example this works fine:

analogWrite(D1,0.5,{freq:4000000})

I'll update the analogWrite docs.