gpio-led-blink.ino

BeagleConnect QuadESC: 4-Channel BLDC Controller · File : gpio-led-blink.ino · Language : C · Use case : Faire clignoter une LED de statut via GPIO pour vérifier le fonctionnement de base.

Minimalist GPIO initialization and Zephyr wait loop example.

Uses Zephyr GPIO API. Requires 'led0' definition in Device Tree. Compile with west build -b am13e23019. Verify LED toggles every 500ms.

gpio-led-blink.ino

#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>

#define LED0_NODE DT_ALIAS(led0)
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);

void main(void) {
    if (!gpio_is_ready_dt(&led)) return;
    gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
    while (1) {
        gpio_pin_toggle_dt(&led);
        k_msleep(500);
    }
}

← Back to the board