GPIO_LED¶
Overview¶
GPIO_LED is a simple application which blinks an LED forever using the GPIO API. The source code shows how to configure GPIO pins as outputs, then turn them on and off.
See PWM Blinky for a sample which uses the PWM API to blink an LED.
Requirements¶
You will see this error if you try to build gpio_led for an unsupported board:
Unsupported board: led0 devicetree alias is not defined
The board must have an LED connected via a GPIO pin. These are called “User
LEDs” on many of Zephyr’s Supported Boards. The LED must be configured using the
led0
devicetree alias. This is usually done in the
BOARD.dts file or a devicetree overlay.
Building and Running¶
Build and flash Blinky as follows, changing reel_board
for your board:
west build -b reel_board samples/boards/csk6/gpio_led
west flash
After flashing, the LED starts to blink. gpio_led does not print to the console.