/**
* Fab Academy Week 4: Embedded Programming
* Task: Basic Digital Output (Blink)
* Board: Seeed Studio XIAO ESP32C3
* * Hardware Connections:
* - LED Anode (+): Connected to Pin D2
* - LED Cathode (-): Connected to 220-ohm Resistor -> GND
*/
// Use the board-specific alias 'D2' for reliability
const int ledPin = D2;
void setup() {
// Initialize Serial Monitor at 115200 baud for debugging status
Serial.begin(115200);
// Set the specified pin as an OUTPUT to drive the LED
pinMode(ledPin, OUTPUT);
Serial.println("--- LED Blink Initialized ---");
}
void loop() {
// Turn the LED ON (Apply 3.3V to Pin D2)
digitalWrite(ledPin, HIGH);
Serial.println("LED: ON");
delay(500); // Maintain state for 0.5 seconds
// Turn the LED OFF (Apply 0V to Pin D2)
digitalWrite(ledPin, LOW);
Serial.println("LED: OFF");
delay(500); // Maintain state for 0.5 seconds
}Loading
xiao-esp32-c3
xiao-esp32-c3