XIAO RP2040 digitalRead & Write BUG

  • Arduino IDE v1.8.15
  • Pacage Seeed XIAO RP2040 v 1.9.3

New Broad without any other componets or wires.
Here’s my code:

void setup() {
  digitalWrite(D1,HIGH);
  Serial.begin(9600);
}
void loop() {
  Serial.println(digitalRead(D1));
}

Guess what , all messages my SerialPort recived is

0
0
0
...
0
0

I tried every digitalpins on both two XIAO RP2040 boards,and they all repeat "0"s
However, my other Arduino boards repeated "1"s with the same code.
Might there be a bug or How can i fix this

Regards,
Mathew

Maybe you need this first
pinMode (D1, OUTPUT);

tried that and works well,thanks a lot.
last gen(seeeduino XIAO SAMD21G18) work well with

void setup() {
  pinMode(D1,INPUT);
  digitalWrite(D1,HIGH);
  Serial.begin(9600);
}
void loop() {
  Serial.println(digitalRead(D1));
}

thus I didnt even think of setting it to output. :rofl:

thank you again
Mathew

1 Like