Nice, I did not know that analogWrite could do PWM with custom frequency.
analogWrite
Yes, analogWrite does the job. You can also change the duty cycle. In my code above, 0.5 after the pin parameter is for 50% of duty cycle.
@halemmerich started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Nice, I did not know that
analogWrite
could do PWM with custom frequency.