I am using an MKR WAN 1300 board.
According to the reference: analogWrite() - Arduino Reference
After a call to analogWrite(), the pin will generate a steady square wave of the specified duty cycle until the next call to analogWrite() (or a call to digitalRead() or digitalWrite()) on the same pin.
In my case, when I use analogWrite it ignores my subsequent digitalWrite.
Here is my test case. It does not turn off my LED, which I have attached to pin 5.
void setup() {
// put your setup code here, to run once:
pinMode(5, OUTPUT);
analogWrite(5, 10);
delay(5000);
digitalWrite(5, LOW);
}
void loop() {
// put your main code here, to run repeatedly:
}