Xiao Esp32C3:
const int buttonPin = 20;  // Button pin
const int ledPin = 8;    // LED pin

void setup() {
  pinMode(buttonPin, INPUT_PULLUP);
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);

  Serial.begin(9600);  // For debug output to the Serial Monitor
  Serial1.begin(9600, SERIAL_8N1, 20, 21);  // UART communication
  Serial.println("Setup complete");
}

void loop() {
  if (digitalRead(buttonPin) == LOW) {
    Serial.println("Button pressed");
    Serial1.write('1');  // Send '1' to turn on LED on RP2040
    delay(200);  // Debounce delay
  }

  if (Serial1.available()) {
    char cmd = Serial1.read();
    Serial.print("Received command: ");
    Serial.println(cmd);
    digitalWrite(ledPin, (cmd == '1') ? HIGH : LOW);
    delay(500);  // Turn on LED for 500 ms
    digitalWrite(ledPin, LOW);
  }
}