{"id":426,"date":"2022-07-18T08:43:24","date_gmt":"2022-07-18T08:43:24","guid":{"rendered":"https:\/\/esp32tutorials.com\/?p=426"},"modified":"2023-01-11T03:08:42","modified_gmt":"2023-01-11T03:08:42","slug":"esp32-esp-idf-freertos-queue-tutorial","status":"publish","type":"post","link":"https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/","title":{"rendered":"ESP32 ESP-IDF FreeRTOS Queue Tutorial"},"content":{"rendered":"\n<p>In this ESP32 ESP-IDF FreeRTOS Queue tutorial, we will learn to create FreeRTOS Queues with ESP32 ESP-IDF. Previously we learned how to<a href=\"https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-tutorial-create-tasks\/\" title=\" create FreeRTOS tasks with ESP32 ESP-IDF\"> create FreeRTOS tasks with ESP32 ESP-IDF<\/a>. However, creating separate tasks does not sufficient for a complete RTOS-based application because these independent tasks are smaller programs having their own stack, memory, and execution jobs. It follows that we require a mechanism for these independent tasks to communicate with one another so that they may exchange data with each other.<\/p>\n\n\n\n<p>The FreeRTOS Kernel offers a mechanism for inter-task data transfer, just as other contemporary RTOS Kernels. Message Queues are what these are called used for this purpose. They serve as the fundamental building block for all FreeRTOS tasks synchronization and communication techniques. They are used to send and receive messages between tasks.<\/p>\n\n\n\n<p>Before we move ahead, make sure you have the latest version of VS Code installed on your system with the ESP-IDF extension configured.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/esp32tutorials.com\/install-esp32-esp-idf-windows-integrate-vs-code\/\">Install ESP32 ESP-IDF on Windows<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/esp32tutorials.com\/install-esp32-esp-idf-linux-ubuntu\/\">Install ESP32 ESP-IDF on Linux Ubuntu<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"FreeRTOS-Queues-Introduction\">FreeRTOS Queues Introduction <\/h2>\n\n\n\n<p>A message queue is a type of FIFO buffer that stores fixed-size data items. Additionally, once a queue has been initialized, the amount of items it may hold is fixed. Generally, Tasks read from the front end of the buffer and write data to the end of the buffer. But writing from the beginning is another option. The buffer can be used by several writers and readers simultaneously.<\/p>\n\n\n\n<p>The buffer, however, may only be used by one writer or reader tasks at a time, and other processes are blocked. As a result, blocking is possible for both writes and reads to the buffer.<\/p>\n\n\n\n<p>For example, task1 sends data to the buffer. task2 reads this data from the buffer and deletes its value from the buffer. Each data block in the FreeRTOS queue can be of any data type or size.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"tasks-blocking-queue-reads\">Tasks Blocking on Queue Reads<\/h3>\n\n\n\n<p>FreeRTOS task can be Blocked on reads is likely in the following situations:<\/p>\n\n\n\n<ol class=\"wp-block-list\" type=\"1\">\n<li>If&nbsp;<strong>multiple tasks<\/strong>&nbsp;are willing to read data from the message queue, the highest priority task gets to read data first and lowest priority one read data at the end. Meanwhile, other tasks stay blocked. We can also set the maximum blocking time of a task while dispatching a read request. But various FreeRTOS tasks can also have distinct blocking times.<\/li>\n\n\n\n<li>The other potential case is when a queue is empty. In such a case, all read requests go to a blocking state. Once data become available from the&nbsp;<strong>message queue<\/strong>&nbsp;(when another task places data into the ready queue), all readers are transferred to the ready state and the highest priority task gets to read from Queue first.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"tasks-blocking-queue-writes\">Tasks Blocking on Queue Writes<\/h3>\n\n\n\n<p>Similar to reading from a queue, A writer task can also optionally define a block time when writing to a queue. For example, a writer&#8217;s task wants to write data to a queue that is already full.  In that case, the block time is the maximum time the task should be kept in the Blocked state to wait for space to become available in the queue <\/p>\n\n\n\n<p>Multiple writer tasks can write in a single Queue. Therefore, there is a possibility that an already filled queue will have more than one task blocked on it waiting to complete a write operation. When this is the case, only one task will be unblocked when space on the queue becomes available.<\/p>\n\n\n\n<p>The task that is unblocked will always be the&nbsp;<strong>highest priority task<\/strong>&nbsp;that was waiting for space. If the blocked tasks have equal priority, then it will be the task that has been waiting for space the longest that is unblocked.<\/p>\n\n\n\n<p>This simulation shows the sequence of reads\/writes:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/microcontrollerslab.com\/wp-content\/uploads\/2020\/04\/FreeRTOS-queue-reading-writing-sequence.gif?w=1200&#038;ssl=1\" alt=\"FreeRTOS queue reading writing sequence\" class=\"wp-image-17292\"\/><figcaption class=\"wp-element-caption\">Source:&nbsp;<a href=\"https:\/\/www.freertos.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">FreeRTOS<\/a><\/figcaption><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"example-code\">ESP32 ESP-IDF FreeRTOS Queue Example Code<\/h2>\n\n\n\n<p>Let us work on the code that we used previously when creating two tasks, and incorporate Queue in it. Refer to the article FreeRTOS Tasks with ESP-IDF before moving ahead. The creation of tasks is already discussed in that article. Here, we will show you how to use Queue.<\/p>\n\n\n\n<p>To use the functionalities of the Queue library provided by FreeRTOS, let us first includes its header file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">#include freertos\/queue.h<\/code><\/pre>\n\n\n\n<p>Next, create a Queue Handle as shown below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">QueueHandle_t queue;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">First Task Function<\/h3>\n\n\n\n<p>Then we will define the Demo_Task function. This will enable us to send data to the buffer. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">void Demo_Task(void *arg)\n{\n    char txBuffer[50];\n    queue = xQueueCreate(5, sizeof(txBuffer)); \n    if (queue == 0)\n    {\n     printf(\"Failed to create queue= %p\\n\", queue);\n    }\n\n    sprintf(txBuffer, \"Hello from Demo_Task 1\");\n    xQueueSend(queue, (void*)txBuffer, (TickType_t)0);\n\n    sprintf(txBuffer, \"Hello from Demo_Task 2\");\n    xQueueSend(queue, (void*)txBuffer, (TickType_t)0); \n\n    sprintf(txBuffer, \"Hello from Demo_Task 3\");\n    xQueueSend(queue, (void*)txBuffer, (TickType_t)0);  \n\n    while(1){\n        vTaskDelay(1000\/ portTICK_RATE_MS);\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>Firstly, we will create an array of characters to store data. It is called &#8216;txBuffer.&#8217;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">char txBuffer[50];<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"create-queue\">Create Queue<\/h4>\n\n\n\n<p>Next, we will create the Queue using <strong>xQueueCreate()<\/strong> function. The first argument is the character number on the Queue buffer whereas the second parameter is the size of each character on the buffer. In our case, it is as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">queue = xQueueCreate(5, sizeof(txBuffer)); <\/code><\/pre>\n\n\n\n<p>As the size of txBuffer is set to 50, each block will have a limit of 50 characters.<\/p>\n\n\n\n<p>Moreover, we will add an if statement to check whether the Queue is created successfully or not.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">if (queue == 0){\nprintf(\"Failed to create queue= %p\\n\", queue);\n}<\/code><\/pre>\n\n\n\n<p> Next, we define the string &#8216;Hello from Demo_Task 1&#8217; that we want to send to the Queue using the sprintf() function.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">sprintf(txBuffer, \"Hello from Demo_Task 1\");<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"write-data-to-queue\">Write Data to Queue<\/h4>\n\n\n\n<p>To send this buffer to Queue we will use<strong> xQueueSend() <\/strong>function. The first argument of this function is the Queue that will be used. In our case, it is &#8216;queue.&#8217; The second argument is the pointer of the data which we are sending. In our case, it is &#8216;(void*)txBuffer.&#8217; The third argument is blocking time. As we do not want to add blocks we will set it to zero.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">xQueueSend(queue, (void*)txBuffer, (TickType_t)0); <\/code><\/pre>\n\n\n\n<p>Let&#8217;s add more strings to the txBuffer and send them to the Queue as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">    sprintf(txBuffer, \"Hello from Demo_Task 1\");\n    xQueueSend(queue, (void*)txBuffer, (TickType_t)0);\n\n    sprintf(txBuffer, \"Hello from Demo_Task 2\");\n    xQueueSend(queue, (void*)txBuffer, (TickType_t)0); \n\n    sprintf(txBuffer, \"Hello from Demo_Task 3\");\n    xQueueSend(queue, (void*)txBuffer, (TickType_t)0);  <\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Second Task Function<\/h3>\n\n\n\n<p>In the second task function, Demo_Task2() we will obtain the data from the Queue buffer.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">void Demo_Task2(void *arg)\n{\n    char rxBuffer[50];\n    while(1){\n     if( xQueueReceive(queue, &amp;(rxBuffer), (TickType_t)5))\n     {\n      printf(\"Received data from queue == %s\/n\", rxBuffer);\n      vTaskDelay(1000\/ portTICK_RATE_MS);\n\n     }\n    }\n}<\/code><\/pre>\n\n\n\n<p>Firstly, we will create an array of characters to store data which will be received from the Queue buffer. It is called &#8216;rxBuffer.&#8217;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">char rxBuffer[50];<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"read-data-from-queue\">Read Data from Queue<\/h4>\n\n\n\n<p>Inside the continuous while loop, we will use the <strong>xQueueReceive()<\/strong> function so that we can read the buffer constantly. Its first argument is the Queue which will be checked from the xQueueSend() function. In our case, it is a queue. The second argument is the pointer of the data which we are receiving. In our case, it is &#8216;&amp;(rxBuffer). The third argument is the blocking time. We will add blocking time while receiving data from Queue buffer so that we do not lose any data.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">xQueueReceive(queue, &amp;(rxBuffer), (TickType_t)5)<\/code><\/pre>\n\n\n\n<p>Moreover, we will add a print statement to check the data received on the serial monitor.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">  if( xQueueReceive(queue, &amp;(rxBuffer), (TickType_t)5))\n     {\n      printf(\"Received data from queue == %s\\n\", rxBuffer);\n      vTaskDelay(1000\/ portTICK_RATE_MS);\n\n     }<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Complete Code <\/h3>\n\n\n\n<p>This is the complete code that we are using for which we explained the parts relating to FreeRTOS Queue.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">#include &lt;stdio.h&gt;\n#include &lt;freertos\/FreeRTOS.h&gt;\n#include &lt;freertos\/task.h&gt;\n#include \"freertos\/queue.h\"\n\nTaskHandle_t myTaskHandle = NULL;\nTaskHandle_t myTaskHandle2 = NULL;\nQueueHandle_t queue;\n\nvoid Demo_Task(void *arg)\n{\n    char txBuffer[50];\n    queue = xQueueCreate(5, sizeof(txBuffer)); \n    if (queue == 0)\n    {\n     printf(\"Failed to create queue= %p\\n\", queue);\n    }\n\n    sprintf(txBuffer, \"Hello from Demo_Task 1\");\n    xQueueSend(queue, (void*)txBuffer, (TickType_t)0);\n\n    sprintf(txBuffer, \"Hello from Demo_Task 2\");\n    xQueueSend(queue, (void*)txBuffer, (TickType_t)0); \n\n    sprintf(txBuffer, \"Hello from Demo_Task 3\");\n    xQueueSend(queue, (void*)txBuffer, (TickType_t)0);  \n\n    while(1){\n        vTaskDelay(1000\/ portTICK_RATE_MS);\n    }\n}\n\nvoid Demo_Task2(void *arg)\n{\n    char rxBuffer[50];\n    while(1){\n     if( xQueueReceive(queue, &amp;(rxBuffer), (TickType_t)5))\n     {\n      printf(\"Received data from queue == %s\\n\", rxBuffer);\n      vTaskDelay(1000\/ portTICK_RATE_MS);\n\n     }\n    }\n}\n\nvoid app_main(void)\n{\n   xTaskCreate(Demo_Task, \"Demo_Task\", 4096, NULL, 10, &amp;myTaskHandle);\n   xTaskCreatePinnedToCore(Demo_Task2, \"Demo_Task2\", 4096, NULL,10, &amp;myTaskHandle2, 1);\n }<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Demonstration<\/h3>\n\n\n\n<p>To flash your chip, type the following command in the serial terminal. Remember to replace the COM port with the one through which your board is connected.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code lang=\"bash\" class=\"language-bash\">idf.py -p COMX flash monitor<\/code><\/pre>\n\n\n\n<p>After the code flashes successfully, this output gets printed in the serial terminal. As you can see from the output of the serial monitor that the first task writes three strings to a queue and the second task reads them as soon as any entry in the queue become available. <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"713\" src=\"https:\/\/i0.wp.com\/esp32tutorials.com\/wp-content\/uploads\/2022\/07\/ESP32-FreeRTOS-Queue-with-ESP-IDF-Example1-demo.jpg?resize=1024%2C713&#038;ssl=1\" alt=\"ESP32 FreeRTOS Queue with ESP-IDF Example1 demo\" class=\"wp-image-432\" srcset=\"https:\/\/i0.wp.com\/esp32tutorials.com\/wp-content\/uploads\/2022\/07\/ESP32-FreeRTOS-Queue-with-ESP-IDF-Example1-demo.jpg?resize=1024%2C713&amp;ssl=1 1024w, https:\/\/i0.wp.com\/esp32tutorials.com\/wp-content\/uploads\/2022\/07\/ESP32-FreeRTOS-Queue-with-ESP-IDF-Example1-demo.jpg?resize=300%2C209&amp;ssl=1 300w, https:\/\/i0.wp.com\/esp32tutorials.com\/wp-content\/uploads\/2022\/07\/ESP32-FreeRTOS-Queue-with-ESP-IDF-Example1-demo.jpg?resize=768%2C535&amp;ssl=1 768w, https:\/\/i0.wp.com\/esp32tutorials.com\/wp-content\/uploads\/2022\/07\/ESP32-FreeRTOS-Queue-with-ESP-IDF-Example1-demo.jpg?w=1069&amp;ssl=1 1069w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p>This is how we can read and write data to Queues using FreeRTOS and perform inter-task communication to share data between independent tasks. Queues provide a secure and efficient way to share data between tasks. <\/p>\n\n\n\n<p>You may also like to read: <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/microcontrollerslab.com\/arduino-freertos-queues-create-read-write-examples\/\" title=\"Arduino FreeRTOS Queue Management \u2013 How to use Queues\">Arduino FreeRTOS Queue Management \u2013 How to use Queues<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In this ESP32 ESP-IDF FreeRTOS Queue tutorial, we will learn to create FreeRTOS Queues with ESP32 ESP-IDF. Previously we learned how to create FreeRTOS tasks with ESP32 ESP-IDF. However, creating &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"ESP32 ESP-IDF FreeRTOS Queue Tutorial\" class=\"read-more button\" href=\"https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/#more-426\" aria-label=\"Read more about ESP32 ESP-IDF FreeRTOS Queue Tutorial\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[9],"tags":[4,3,14,15],"class_list":["post-426","post","type-post","status-publish","format-standard","hentry","category-esp32-esp-idf-tutorials","tag-esp-idf","tag-esp32","tag-freertos","tag-queue"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>ESP32 ESP-IDF FreeRTOS Queue Tutorial<\/title>\n<meta name=\"description\" content=\"ESP32 ESP-IDF FreeRTOS Queue tutorial learn to create a queue to perform inter-task communication between different RTOS tasks with example code\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ESP32 ESP-IDF FreeRTOS Queue Tutorial\" \/>\n<meta property=\"og:description\" content=\"ESP32 ESP-IDF FreeRTOS Queue tutorial learn to create a queue to perform inter-task communication between different RTOS tasks with example code\" \/>\n<meta property=\"og:url\" content=\"https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"ESP32 ESP-IDF\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-18T08:43:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-11T03:08:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/microcontrollerslab.com\/wp-content\/uploads\/2020\/04\/FreeRTOS-queue-reading-writing-sequence.gif\" \/>\n<meta name=\"author\" content=\"Bilal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bilal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/esp32tutorials.com\\\/esp32-esp-idf-freertos-queue-tutorial\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/esp32tutorials.com\\\/esp32-esp-idf-freertos-queue-tutorial\\\/\"},\"author\":{\"name\":\"Bilal\",\"@id\":\"https:\\\/\\\/esp32tutorials.com\\\/#\\\/schema\\\/person\\\/d648bc7f340c02d211193ac9efc2e3a5\"},\"headline\":\"ESP32 ESP-IDF FreeRTOS Queue Tutorial\",\"datePublished\":\"2022-07-18T08:43:24+00:00\",\"dateModified\":\"2023-01-11T03:08:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/esp32tutorials.com\\\/esp32-esp-idf-freertos-queue-tutorial\\\/\"},\"wordCount\":1232,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\\\/\\\/esp32tutorials.com\\\/#\\\/schema\\\/person\\\/d648bc7f340c02d211193ac9efc2e3a5\"},\"image\":{\"@id\":\"https:\\\/\\\/esp32tutorials.com\\\/esp32-esp-idf-freertos-queue-tutorial\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/microcontrollerslab.com\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/FreeRTOS-queue-reading-writing-sequence.gif\",\"keywords\":[\"esp-idf\",\"esp32\",\"FreeRTOS\",\"Queue\"],\"articleSection\":[\"ESP32 Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/esp32tutorials.com\\\/esp32-esp-idf-freertos-queue-tutorial\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/esp32tutorials.com\\\/esp32-esp-idf-freertos-queue-tutorial\\\/\",\"url\":\"https:\\\/\\\/esp32tutorials.com\\\/esp32-esp-idf-freertos-queue-tutorial\\\/\",\"name\":\"ESP32 ESP-IDF FreeRTOS Queue Tutorial\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/esp32tutorials.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/esp32tutorials.com\\\/esp32-esp-idf-freertos-queue-tutorial\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/esp32tutorials.com\\\/esp32-esp-idf-freertos-queue-tutorial\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/microcontrollerslab.com\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/FreeRTOS-queue-reading-writing-sequence.gif\",\"datePublished\":\"2022-07-18T08:43:24+00:00\",\"dateModified\":\"2023-01-11T03:08:42+00:00\",\"description\":\"ESP32 ESP-IDF FreeRTOS Queue tutorial learn to create a queue to perform inter-task communication between different RTOS tasks with example code\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/esp32tutorials.com\\\/esp32-esp-idf-freertos-queue-tutorial\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/esp32tutorials.com\\\/esp32-esp-idf-freertos-queue-tutorial\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/esp32tutorials.com\\\/esp32-esp-idf-freertos-queue-tutorial\\\/#primaryimage\",\"url\":\"https:\\\/\\\/microcontrollerslab.com\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/FreeRTOS-queue-reading-writing-sequence.gif\",\"contentUrl\":\"https:\\\/\\\/microcontrollerslab.com\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/FreeRTOS-queue-reading-writing-sequence.gif\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/esp32tutorials.com\\\/esp32-esp-idf-freertos-queue-tutorial\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/esp32tutorials.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ESP32 ESP-IDF FreeRTOS Queue Tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/esp32tutorials.com\\\/#website\",\"url\":\"https:\\\/\\\/esp32tutorials.com\\\/\",\"name\":\"ESP32 ESP-IDF\",\"description\":\"ESP32 ESP IDF Tutorials and Projects\",\"publisher\":{\"@id\":\"https:\\\/\\\/esp32tutorials.com\\\/#\\\/schema\\\/person\\\/d648bc7f340c02d211193ac9efc2e3a5\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/esp32tutorials.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/esp32tutorials.com\\\/#\\\/schema\\\/person\\\/d648bc7f340c02d211193ac9efc2e3a5\",\"name\":\"Bilal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/esp32tutorials.com\\\/wp-content\\\/litespeed\\\/avatar\\\/b623b0da24dec30042f1540f5437f129.jpg?ver=1775014292\",\"url\":\"https:\\\/\\\/esp32tutorials.com\\\/wp-content\\\/litespeed\\\/avatar\\\/b623b0da24dec30042f1540f5437f129.jpg?ver=1775014292\",\"contentUrl\":\"https:\\\/\\\/esp32tutorials.com\\\/wp-content\\\/litespeed\\\/avatar\\\/b623b0da24dec30042f1540f5437f129.jpg?ver=1775014292\",\"caption\":\"Bilal\"},\"logo\":{\"@id\":\"https:\\\/\\\/esp32tutorials.com\\\/wp-content\\\/litespeed\\\/avatar\\\/b623b0da24dec30042f1540f5437f129.jpg?ver=1775014292\"},\"description\":\"We are a team of experienced Embedded Software Developers with skills in developing Embedded Linux, RTOS, and IoT products from scratch to deployment with a demonstrated history of working in the embedded software industry. Contact us for your projects: admin@esp32tutorials.com\",\"sameAs\":[\"http:\\\/\\\/esp32tutorials.com\"],\"url\":\"https:\\\/\\\/esp32tutorials.com\\\/author\\\/esp32tutorialslab\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ESP32 ESP-IDF FreeRTOS Queue Tutorial","description":"ESP32 ESP-IDF FreeRTOS Queue tutorial learn to create a queue to perform inter-task communication between different RTOS tasks with example code","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"ESP32 ESP-IDF FreeRTOS Queue Tutorial","og_description":"ESP32 ESP-IDF FreeRTOS Queue tutorial learn to create a queue to perform inter-task communication between different RTOS tasks with example code","og_url":"https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/","og_site_name":"ESP32 ESP-IDF","article_published_time":"2022-07-18T08:43:24+00:00","article_modified_time":"2023-01-11T03:08:42+00:00","og_image":[{"url":"https:\/\/microcontrollerslab.com\/wp-content\/uploads\/2020\/04\/FreeRTOS-queue-reading-writing-sequence.gif","type":"","width":"","height":""}],"author":"Bilal","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Bilal","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/#article","isPartOf":{"@id":"https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/"},"author":{"name":"Bilal","@id":"https:\/\/esp32tutorials.com\/#\/schema\/person\/d648bc7f340c02d211193ac9efc2e3a5"},"headline":"ESP32 ESP-IDF FreeRTOS Queue Tutorial","datePublished":"2022-07-18T08:43:24+00:00","dateModified":"2023-01-11T03:08:42+00:00","mainEntityOfPage":{"@id":"https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/"},"wordCount":1232,"commentCount":3,"publisher":{"@id":"https:\/\/esp32tutorials.com\/#\/schema\/person\/d648bc7f340c02d211193ac9efc2e3a5"},"image":{"@id":"https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/microcontrollerslab.com\/wp-content\/uploads\/2020\/04\/FreeRTOS-queue-reading-writing-sequence.gif","keywords":["esp-idf","esp32","FreeRTOS","Queue"],"articleSection":["ESP32 Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/","url":"https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/","name":"ESP32 ESP-IDF FreeRTOS Queue Tutorial","isPartOf":{"@id":"https:\/\/esp32tutorials.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/microcontrollerslab.com\/wp-content\/uploads\/2020\/04\/FreeRTOS-queue-reading-writing-sequence.gif","datePublished":"2022-07-18T08:43:24+00:00","dateModified":"2023-01-11T03:08:42+00:00","description":"ESP32 ESP-IDF FreeRTOS Queue tutorial learn to create a queue to perform inter-task communication between different RTOS tasks with example code","breadcrumb":{"@id":"https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/#primaryimage","url":"https:\/\/microcontrollerslab.com\/wp-content\/uploads\/2020\/04\/FreeRTOS-queue-reading-writing-sequence.gif","contentUrl":"https:\/\/microcontrollerslab.com\/wp-content\/uploads\/2020\/04\/FreeRTOS-queue-reading-writing-sequence.gif"},{"@type":"BreadcrumbList","@id":"https:\/\/esp32tutorials.com\/esp32-esp-idf-freertos-queue-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/esp32tutorials.com\/"},{"@type":"ListItem","position":2,"name":"ESP32 ESP-IDF FreeRTOS Queue Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/esp32tutorials.com\/#website","url":"https:\/\/esp32tutorials.com\/","name":"ESP32 ESP-IDF","description":"ESP32 ESP IDF Tutorials and Projects","publisher":{"@id":"https:\/\/esp32tutorials.com\/#\/schema\/person\/d648bc7f340c02d211193ac9efc2e3a5"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/esp32tutorials.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/esp32tutorials.com\/#\/schema\/person\/d648bc7f340c02d211193ac9efc2e3a5","name":"Bilal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/esp32tutorials.com\/wp-content\/litespeed\/avatar\/b623b0da24dec30042f1540f5437f129.jpg?ver=1775014292","url":"https:\/\/esp32tutorials.com\/wp-content\/litespeed\/avatar\/b623b0da24dec30042f1540f5437f129.jpg?ver=1775014292","contentUrl":"https:\/\/esp32tutorials.com\/wp-content\/litespeed\/avatar\/b623b0da24dec30042f1540f5437f129.jpg?ver=1775014292","caption":"Bilal"},"logo":{"@id":"https:\/\/esp32tutorials.com\/wp-content\/litespeed\/avatar\/b623b0da24dec30042f1540f5437f129.jpg?ver=1775014292"},"description":"We are a team of experienced Embedded Software Developers with skills in developing Embedded Linux, RTOS, and IoT products from scratch to deployment with a demonstrated history of working in the embedded software industry. Contact us for your projects: admin@esp32tutorials.com","sameAs":["http:\/\/esp32tutorials.com"],"url":"https:\/\/esp32tutorials.com\/author\/esp32tutorialslab\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/esp32tutorials.com\/wp-json\/wp\/v2\/posts\/426","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/esp32tutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/esp32tutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/esp32tutorials.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/esp32tutorials.com\/wp-json\/wp\/v2\/comments?post=426"}],"version-history":[{"count":0,"href":"https:\/\/esp32tutorials.com\/wp-json\/wp\/v2\/posts\/426\/revisions"}],"wp:attachment":[{"href":"https:\/\/esp32tutorials.com\/wp-json\/wp\/v2\/media?parent=426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/esp32tutorials.com\/wp-json\/wp\/v2\/categories?post=426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/esp32tutorials.com\/wp-json\/wp\/v2\/tags?post=426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}