zephyr/samples/basic/threads
Sahaj Sarup b6c70fd331 samples: Basic Thread Demo
A basic demo to showcase multi-threading using K_THREAD_DEFINE

Signed-off-by: Sahaj Sarup <sahaj.sarup@linaro.org>
2017-11-07 08:28:32 -05:00
..
src samples: Basic Thread Demo 2017-11-07 08:28:32 -05:00
Makefile samples: Basic Thread Demo 2017-11-07 08:28:32 -05:00
prj.conf samples: Basic Thread Demo 2017-11-07 08:28:32 -05:00
README.rst samples: Basic Thread Demo 2017-11-07 08:28:32 -05:00
sample.yaml samples: Basic Thread Demo 2017-11-07 08:28:32 -05:00

.. _96b_carbon_multi_thread_blinky:

Basic Thread Example
####################

Overview
********

This example demonstrates spawning of multiple threads using K_THREAD_DEFINE.

The example works by spawning  three threads. The first two threads control a
separate LED. Both of these LEDs (USR1 and USR2) have their individual loop
control and timing logic defined by separate functions.

The third thread, uart_out(), sends out messages on the UART using printk().

- blink1() controls the USR1 LED that has a 100ms sleep cycle
- blink2() controls the USR2 LED that has a 1000ms sleep cycle

Each thread is then defined at compile time using K_THREAD_DEFINE.

Building
********

.. code-block:: console

    $ cd samples/basic/threads
    $ make