Fail to do port command XIAO

Hi all,

I am trying to use the port command to pull the pins simultaneously in the Xiao Module. However, I keep encounter an error saying that
"
lvalue required as left operand of assignment
PORTA =PORTA | 0b0;
"
Here is the code. Does anyone if I am doing anything wrong? Thanks in advance

#include <Arduino.h>
void setup() {
PORTA =PORTA | 0b0;
PORTB= PORTB | 0b0;

}

void loop() {
PORTA = (PORTA| 0b10000001);
delay(100);
PORTA = (PORTA | 0b00000000);
delay(900);
}

Hi @JB_12

Please feel free to check here; Direct port access in Arduino IDE

Hi @ansonhe97

Thank you for your reply.
The reason I am trying to use port command is because it can drive multiple IO simultaneously, but it looks like using these function can only switch one IO at a time? Do you know if there is a way to drive the IO simultaneously in XIAO? Thank you.

Oh actually OR the pins together will do the work

uint32_t pinMaskOut = MASK(pinOut_D3)|MASK(pinOut_D4)|MASK(pinOut_D5);

1 Like