I’ve got an XIAO that I’m using to send PWM signals to a motor controller, nothing special. The problem is that the motors whine quite loudly, because the PWM frequency is in the human hearing range. I am currently using the Arduino IDE to write my code, and I am simply using the analogWrite() function to set the PWM duty cycle. Is there a way to increase the PWM frequency by e.g. changing the prescale value for the appropriate timers?
I apologize if this has already been covered, but I can’t seem to find anything that clearly solves this problem (which is surprising, considering how common I imagine this problem is).