Pwm_Leds.cpp
// The pins are declared
#define LED_1 D0
#define LED_2 D6
#define LED_3 D7
#define button D1

// A global variable is declared for the maximum PWM value, 
// which in this case is for an 8-bit resolution although 
// the xiao allows for a 16-bit resolution, but no significant 
// difference is noticed.
const int maxPwmValue = 255;

void setup() {
  // The outputs and inputs are declared
  pinMode(LED_1, OUTPUT);
  pinMode(LED_2, OUTPUT);
  pinMode(LED_3, OUTPUT);
  pinMode(button, INPUT);

  // The serial monitor is initialized
  Serial.begin(9600);
}

void loop() {
  // It declares a temporary variable
  int i = 0;

  // The LEDs are initialized in the "off" state.
  analogWrite(LED_1, 0);
  analogWrite(LED_2, 0);
  analogWrite(LED_3, 0);
  delay(100);

  // It will execute while the button is pressed and the 
  // temporary variable won't exceed the maximum value of 
  // the PWM, which in this case is 255
  while(digitalRead(button) == HIGH && i < maxPwmValue){
    
    // It turns on the LEDs in a progressive way, incrementing 
    // by 10 the temporary variable until it reaches the maximum 
    // value.
    analogWrite(LED_1, i);
    analogWrite(LED_2, i);
    analogWrite(LED_3, i);
    delay(200);
    i += 10;
  }
}