PWM frequency

Does anyone know how to change the PWM frequency for an Arduino wifi rev2. I have seen people change the PWM switching frequency with the Arduino Uno but the wifi does not allow me to use the same example. Since I'm very new to Arduino I wanted to know if there is a way of doing this like they do in the following link: https://etechnophiles.com/change-frequency-pwm-pins-arduino-uno/

I appreciate the help.
Thank you

Those boards use the ATMega4809 chip vs. the '328p on the UNO. You would have to look at the datasheets for both to see what is different and adapt the code. I'm guessing that some of the registers, etc. may be named differently but it should be possible.

That’s what I thought but when I looked for the ATMega4809 datasheets I didn’t find anything that assimilates.

Have a look at the megaAVR0 series datasheet, chapter 19.3 or search for PWM.

The hardware is quite similar to the ATmega328, but the register and bit names differ. Also some commands are supported, which seem to initialize multiple registers and modes. The frequency depends on the prescaler and selected TOP value.

DrDiettrich:
Have a look at the megaAVR0 series datasheet, chapter 19.3 or search for PWM.

The hardware is quite similar to the ATmega328, but the register and bit names differ. Also some commands are supported, which seem to initialize multiple registers and modes. The frequency depends on the prescaler and selected TOP value.

Thank you i will take a look

Have you tried analogWriteFrequency() or analogWriteFreq()? It's not implemented in many Arduino cores, but worth a try. Teensy, Particle and ESP cores have it, for example.

Did you ever figure it out? I am using the new Arduino Every (uses this chip also) and also want to set the PWM frequency...

@MAT1227 Did you every figure this out? I'm having a similar issue with implementing a 1kHz fundamental frequency on the Arduino Uno WiFi Rev2.