1.. zephyr:code-sample:: uart 2 :name: UART echo 3 :relevant-api: uart_interface 4 5 Read data from the console and echo it back. 6 7Overview 8******** 9 10This sample demonstrates how to use the UART serial driver with a simple 11echo bot. It reads data from the console and echoes the characters back after 12an end of line (return key) is received. 13 14The polling API is used for sending data and the interrupt-driven API 15for receiving, so that in theory the thread could do something else 16while waiting for incoming data. 17 18By default, the UART peripheral that is normally used for the Zephyr shell 19is used, so that almost every board should be supported. 20 21Building and Running 22******************** 23 24Build and flash the sample as follows, changing ``nrf52840dk/nrf52840`` for 25your board: 26 27.. zephyr-app-commands:: 28 :zephyr-app: samples/drivers/uart/echo_bot 29 :board: nrf52840dk/nrf52840 30 :goals: build flash 31 :compact: 32 33Sample Output 34============= 35 36.. code-block:: console 37 38 Hello! I\'m your echo bot. 39 Tell me something and press enter: 40 # Type e.g. "Hi there!" and hit enter! 41 Echo: Hi there! 42