2017-04-05 03:20:40 +08:00
|
|
|
.. _disco-sample:
|
|
|
|
|
2017-01-06 23:26:27 +08:00
|
|
|
Disco demo
|
|
|
|
##########
|
|
|
|
|
|
|
|
Overview
|
2017-01-21 07:58:05 +08:00
|
|
|
********
|
2017-01-06 23:26:27 +08:00
|
|
|
|
|
|
|
A simple 'disco' demo. The demo assumes that 2 LEDs are connected to
|
|
|
|
GPIO outputs of the MCU/board.
|
|
|
|
|
|
|
|
|
|
|
|
Wiring
|
2017-01-21 07:58:05 +08:00
|
|
|
******
|
2017-01-06 23:26:27 +08:00
|
|
|
|
2018-12-03 08:55:16 +08:00
|
|
|
This sample should work on board with multiple built-in LEDs without any
|
|
|
|
changes, otherwise, the code may need some changes before running on various
|
|
|
|
board: set PORT, LED0 and LED1 according to the board's GPIO configuration.
|
|
|
|
|
2017-01-06 23:26:27 +08:00
|
|
|
Building and Running
|
2017-01-21 07:58:05 +08:00
|
|
|
*********************
|
2017-01-06 23:26:27 +08:00
|
|
|
|
2017-01-07 07:49:24 +08:00
|
|
|
After startup, the program looks up a predefined GPIO device defined by 'PORT',
|
2018-12-03 08:55:16 +08:00
|
|
|
and configures pins 'LED0' and 'LED1' in output mode. During each iteration of
|
2017-01-07 07:49:24 +08:00
|
|
|
the main loop, the state of GPIO lines will be changed so that one of the lines
|
|
|
|
is in high state, while the other is in low, thus switching the LEDs on and off
|
|
|
|
in an alternating pattern.
|
2017-01-06 23:26:27 +08:00
|
|
|
|
2017-01-07 07:49:24 +08:00
|
|
|
This project does not output to the serial console, but instead causes two LEDs
|
|
|
|
connected to the GPIO device to blink in an alternating pattern.
|
|
|
|
|
2019-03-09 06:21:37 +08:00
|
|
|
The sample can be found here: :zephyr_file:`samples/basic/disco`.
|