Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Shows sending and receiving messages via FreeRTOS queue.
#include <FreeRTOS.h>
#include <task.h>
#include <queue.h>
#include <stdio.h>
QueueHandle_t xQueue;
void vSenderTask(void* pvParameters) {
int value = 42;
xQueueSend(xQueue, &value, portMAX_DELAY);
vTaskDelete(NULL);
}
void vReceiverTask(void* pvParameters) {
int received;
xQueueReceive(xQueue, &received, portMAX_DELAY);
printf("Received: %d\n", received);
vTaskDelete(NULL);
}
int main() {
xQueue = xQueueCreate(1, sizeof(int));
xTaskCreate(vSenderTask, "Sender", configMINIMAL_STACK_SIZE, NULL, 1, NULL);
xTaskCreate(vReceiverTask, "Receiver", configMINIMAL_STACK_SIZE, NULL, 1, NULL);
vTaskStartScheduler();
return 0;
}FreeRTOS is a lightweight, open-source real-time operating system (RTOS) kernel for embedded devices. It provides multitasking, scheduling, and inter-task communication for microcontrollers and small processors.
Origin & Creator
Created by Richard Barry in 2003, now maintained and extended by Amazon Web Services as Amazon FreeRTOS and FreeRTOS Kernel.
Industrial Note
Essential in embedded systems requiring predictable real-time behavior, small footprint, and multitasking support-commonly used in IoT sensors, motor control, and safety-related microcontroller applications.