Freertos Tutorial Pdf May 2026
// Task 1: Sender task void sender_task(void *pvParameters) { int i; for (i = 0; i < 10; i++) { // Send a message to the queue xQueueSend(xQueue, &i, 100); vTaskDelay(100); } }
while(1); } This code creates two tasks, sender_task and receiver_task , and uses a queue to send and receive messages between them. freertos tutorial pdf
#include "FreeRTOS.h" #include "queue.h" // Task 1: Sender task void sender_task(void *pvParameters)
// Task 2: Receiver task void receiver_task(void *pvParameters) { int i; for (i = 0; i < 10; i++) { // Receive a message from the queue xQueueReceive(xQueue, &i, 100); printf("Received: %d\n", i); } } for (i = 0
int main(void) { // Create the queue xQueue = xQueueCreate(5, sizeof(int));