28 lines
869 B
Arduino
28 lines
869 B
Arduino
// Blink-Test für den Seeed Studio XIAO ESP32-C3.
|
|
// Das Board hat keine eigene User-LED: externe LED mit ~220 Ω Vorwiderstand an D10 gegen GND.
|
|
// Jeder Takt wird zusätzlich über USB-Serial ausgegeben, dazu der Zustand der BOOT-Taste.
|
|
|
|
const int LED_PIN = D10;
|
|
const int BOOT_BUTTON_PIN = 9; // BOOT-Taste auf der Platine, gedrückt = LOW
|
|
const unsigned long BLINK_INTERVAL_MS = 500;
|
|
|
|
void setup() {
|
|
Serial.begin(115200);
|
|
pinMode(LED_PIN, OUTPUT);
|
|
pinMode(BOOT_BUTTON_PIN, INPUT_PULLUP);
|
|
}
|
|
|
|
void loop() {
|
|
static bool ledOn = false;
|
|
static unsigned long count = 0;
|
|
|
|
ledOn = !ledOn;
|
|
digitalWrite(LED_PIN, ledOn ? HIGH : LOW);
|
|
|
|
bool buttonPressed = digitalRead(BOOT_BUTTON_PIN) == LOW;
|
|
Serial.printf("#%lu LED %s | BOOT-Taste %s\n", ++count, ledOn ? "an " : "aus",
|
|
buttonPressed ? "gedrückt" : "-");
|
|
|
|
delay(BLINK_INTERVAL_MS);
|
|
}
|