bbcmicrobit / micropython

Port of MicroPython for the BBC micro:bit
https://microbit-micropython.readthedocs.io
Other
602 stars 284 forks source link

Set PWM frequency to 10kHz #673

Open Bhavithiran97 opened 4 years ago

Bhavithiran97 commented 4 years ago

Hi, I wanna set the pwm frequency to 10kHz, but the minimum value for set_analog_period_microseconds is 256us which results in 3.91kHz. I can set to 10kHz in makecode. Is there any other way for me to set the pwm frequency to 10kHz ?

rhubarbdog commented 1 year ago

Yes with arm thumb 2 assembly see this repository https://github.com/rhubarbdog/microbit-assembly for some example code. The examples are mainly for version 2 microbial. Be careful with high frequencies from 30khz dogs are affected at 50khz rats and mice will be attracted