I’m working with Atmel SAMD microcontroller on Adafruit Feather M0 board. Looking at the documentation of analogWrite() - Arduino Reference, I read that PWM will be stopped or changed by next call to analogWrite() (or a call to digitalRead() or digitalWrite()) on the same pin. In my tests, only analogWrite() affects the PWM on given pin, e.g.:
will leave pin #1 in low state, but
will leave it producing 50% duty cycle PWM. Is this behavior normal?
The Arduino documentation can be pretty worthless when working with other core implementations. Every Arduino core implementation is technically free to do whatever it wants and does not implement every caveat in the documentation of the official Arduino documentation. The code of the core implementation has to the final say.
You will e.g. see that with the “exemplary” AVR arduino core implementation, digitalWrite() does…
…turn off the PWM, aka the timer associated with the pin. That stops the wave.
However, with the Adafruit SAMD core implementation of digitalWrite(), you will see no such thing – just setting the GPIO registers and not bothering to turn off any eventually running PWM wave.