Back to Riot

Examples

examples/README.md

2026.07-devel12.2 KB
Original Source

Examples

RIOT provides a wide range of examples to demonstrate the capabilities of the OS and its modules.

Each example contains a README.md that provides information and instructions how to run it.

Here is a quick overview of the examples available in the RIOT:

The Essentials

ExampleDescription
defaultThis application is a showcase for RIOT's hardware support. Using it for your board, you should be able to interactively use any hardware that is supported.
hello-worldA simple "Hello World" that shows the basic structure of a RIOT application.
blinkyThe classic "Hello World" example for embedded systems: blinking an LED (or printing "Blink!" via stdio when none are available).
leds_shellThe application leds_shell is a basic example, which allows easy, interactive control of internal board LEDs, and basic GPIO for externally connected simple devices (for e.g. additional LEDs, relay, motors - via dedicated drivers, etc.) via the shell.
saulThis example demonstrates the usage of the SAUL (Sensor Actuator Uber Layer) module.
timer_periodic_wakeupHow to set up a periodic wakeup timer using the RIOT operating system.
ipc_pingpongThis example is to illustrate the usage of RIOTs IPC messaging system.
filesystemThis example showcases ways to interact/manage the filesystem in RIOT.
subfoldersThis example demonstrates how to use subfolders in RIOT applications.

RIOT Language Bindings

Officially Supported/Targeted

Rust
ExampleDescription
rust-hello-worldThis example demonstrates how to write a simple RIOT application in Rust.
rust-gcoapThis example demonstrates how to write a coap server application in Rust using the RIOTs gcoap module.
rust-asyncThis example demonstrates how to use Rusts async/await syntax in a RIOT application.
C++
ExampleDescription
riot_and_cppExample of using C++ in RIOT applications.

Community Supported

ExampleDescription
javascriptHow to write IoT applications using javascript using JerryScript.
lua_basicHow to write IoT applications using Lua.
lua_REPLThis example demonstrates how to use the Lua Read-Eval-Print Loop (REPL) in RIOT.
micropythonHow to use the MicroPython port for RIOT.
wasmHow to use WebAssembly in RIOT.
arduino_hello-worldThis application demonstrates the usage of Arduino sketches in RIOT.

Networking

Constraint Application Protocol (CoAP)

ExampleDescription
gcoapThis example demonstrates the usage of the gcoap module, a high-level API for CoAP (Constrained Application Protocol) messaging.
gcoap_block_serverCoAP server handling for Block requests, build with gcoap using nanocoap block handling functions.
gcoap_fileserverThis example demonstrates the usage of the gcoap module to serve files over CoAP.
gcoap_dtlsThis example demonstrates the usage of the gcoap module with DTLS.
nanocoap_serverThis example demonstrates the usage of the nanocoap module, a high-level API for CoAP (Constrained Application Protocol) messaging.

Bluetooth Low Energy (BLE)

NimBLE

ExampleDescription
nimble_scannerThis example showcases the usage of the NimBLE BLE stack as a scanner.
nimble_gattThis example application configures and runs the NimBLE BLE stack as simple GATT server.
nimble_heart_rate_sensorThis example demonstrates how to implement asynchronous data transfer using GATT notifications by implementing a mock-up BLE heart rate sensor.

Misc BLE Examples

ExampleDescription
skald_eddystoneThis example demonstrates the usage of Skald for creating an Google Eddystone beacon.
skald_ibeaconThis example demonstrates the usage of Skald for creating an Apple iBeacon.

MQTT

ExampleDescription
asymcute_mqttsnThis application demonstrates the usage of the Asymcute (MQTT-SN) module in RIOT.
emcute_mqttsnThis application demonstrates the usage of the emCute (MQTT-SN) module in RIOT.
paho-mqttThis example demonstrates the usage of the Paho MQTT client library in RIOT.

CoRE Resource Directory

ExampleDescription
cord_epExample of RIOT's Resource Directory (RD) endpoint module, called cord_ep
cord_lcExample of RIOT's Resource Directory (RD) lookup module, called cord_lc
cord_epsimThis example shows how a node can register with a CoRE resource directory

GNRC Networking

ExampleDescription
gnrc_minimalThis is a minimalistic example for RIOT's gnrc network stack.
gnrc_networkingThis example demonstrates the usage of the GNRC network stack in RIOT.
gnrc_networking_subnetsThis example demonstrates IPv6 subnet auto-configuration for networks on a tree topology.
gnrc_border_routerExample of gnrc_border_router using automatic configuration
gnrc_lorawanSend and receive LoRaWAN packets and perform basic LoRaWAN commands

DTLS

ExampleDescription
dtls-sockThis example shows how to use DTLS sock sock_dtls_t
dtls-echoThis example shows how to use TinyDTLS with sock_udp.
dtls-wolfsslThis example demonstrates the usage of the DTLS module with the wolfSSL library.

Misc

ExampleDescription
lorawanThis application shows a basic LoRaWAN use-case with RIOT.
openthreadThis example demonstrates the usage of the OpenThread stack in RIOT.
lwm2mExample of a LWM2M client on RIOT
ccn-lite-relayThis application demonstrates how to use the Content-Centric Networking stack from CCN-Lite on RIOT
telnet_serverSimple telnet server that listens on port 23 over IPv6.
posix_socketsShowcase for RIOT's POSIX socket support
spectrum-scannerThis example demonstrates how to monitor energy levels on all available wireless channels
snifferThis application is built to run together with the script ./tools/sniffer.py as a sniffer for (wireless) data traffic.
benckmark_udpThis example uses the benchmark_udp module to create a stress-test for the RIOT network stack.
sock_tcp_echoThis is a simple TCP echo server / client that uses the SOCK API.
lwip_ipv4This is a simple UDP client / server using LWIP for IPv4.

Advanced Examples

ExampleDescription
bindistRIOT allows for creating a "binary distribution", which can be used to ship proprietary, compiled objects in a way that makes it possible to re-link them against a freshly compiled RIOT. This application serves as a simple example.
usbus_minimalThis is a minimalistic example for RIOT's USB stack.
suit_updateThis example shows how to integrate SUIT-compliant firmware updates into a RIOT application.
thread_duelThis is a thread duel application to show RIOTs abilities to run multiple-threads concurrently, even if they are neither cooperative nor dividable into different scheduler priorities, by using the optional round-robin scheduler module.
posix_selectThis example is a showcase for RIOT's POSIX select support
psa_cryptoBasic functions of the PSA Crypto API
pio_blinkHow to use the PIO peripheral on the RaspberryPi Pico to blink an LED.
twr_alohaThis example allows testing different two-way ranging algorithms between two boards supporting a dw1000 device. This makes use of the uwb-core pkg.
senml_saulThis example demonstrates the usage of the SAUL (Sensor Actuator Uber Layer) module with the SenML (Sensor Measurement Lists) format.
opendsmeThis example demonstrates the usage of the OpenDSME module in RIOT.
xipfsThis example demonstrates the usage of XIPFS for creating and executing an executable file.

Examples from Guides

Our guides walk you through small tutorials to get started. The following examples are the resulting code from completing their respective guide.

ExampleDescription
creating_projectTeaches you the very first steps. How to setup a RIOT project, build and run a Hello World in it. Create Project tutorial
shellTeaches you how to use the interactive RIOT shell for your application. Shell tutorial
gpioTeaches you how to configure and use GPIO pins for external hardware interaction. GPIO tutorial
saulTeaches you how to interact with sensors and actuators through the SAUL interface. SAUL tutorial
threadsTeaches you how to create and manage multiple execution threads in your RIOT application. Threads tutorial
timersTeaches you how to use timers for periodic tasks and time measurement in RIOT. Timers tutorial
event_queueTeaches you how to use the event queue. Event Queue guide