1. Home
  2. /
  3. Zephyr-rtos
  4. /
  5. Periodic Thread Example

Periodic Thread Example - Zephyr-rtos Typing CST Test

Loading…

Periodic Thread Example — Zephyr-rtos Code

Create a periodic thread to execute a task every 1 second.

void periodic_task(void *arg1, void *arg2, void *arg3)
{
	while(1) {
		printk("Periodic task running\n");
		k_sleep(K_SECONDS(1));
	}
}

K_THREAD_DEFINE(periodic_thread, 1024, periodic_task, NULL, NULL, NULL, 7, 0, 0);

Zephyr-rtos Language Guide

Zephyr RTOS is a scalable, open-source real-time operating system designed for resource-constrained embedded devices. It provides a small, configurable kernel, drivers, and networking stacks to enable IoT, wearable, and sensor-based applications with predictable timing and low memory footprint.

Primary Use Cases

  • ▸Real-time task scheduling for embedded applications
  • ▸Low-power IoT devices and wearables
  • ▸Sensor data acquisition and processing
  • ▸Networking-enabled devices with MQTT, CoAP, or BLE
  • ▸Industrial automation and edge computing

Notable Features

  • ▸Modular and configurable kernel
  • ▸Support for multiple architectures and boards
  • ▸Extensive device driver library
  • ▸Real-time thread management and synchronization
  • ▸Networking stack including Bluetooth, IPv4/IPv6, and 6LoWPAN

Origin & Creator

Initially developed by Wind River and now governed by the Linux Foundation, Zephyr was created to provide a lightweight, open-source RTOS for embedded devices and IoT applications.

Industrial Note

Critical for embedded developers who require a deterministic, low-memory RTOS for safety-critical, battery-powered, or connected devices, enabling rapid development and robust device behavior.

More Zephyr-rtos Typing Exercises

Blink LED TaskSensor Reading Example

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher