Changing Arduino Zero PWM Frequency

Unfortunately the issue with the analogWrite() function, is that it will set up a predefined timer and frequency on a given pin, this will interfere with code above.

I've tried the analogWrite(8,x) with your code and it works fine. Changing the value of x between 0 and 255 change the time which the led stay on in a period of one second.

What would you like the LED outputs to do? What frequency (range) and duty-cycle do you intend to use?

The purpose is the same as the pin 8. I need to make two led connected on pin 2 and 3 blinks with the PWM so, it would be amazing if I can set the frequency to 0.5Hz as on the previous example and then I make it blink slower or faster changing the duty cycle with analogWrite(2,x) and analogWrite(3,x)

Does the changing of the PWM frequency on pins 2 and 3 will change the running time of my whole firmware (like will change delays) or is it unlinked from the actual clock speed of the board?