Forgive me, I am still new to C++ and am learning FreeRTOS.
I am trying to send 3 float values using xQueueSend.
The problem is that only the first float is being successfully received.
Looking for some help please.
This running on an ESP32 using PlatformIO to compile, the other code runs fine, it’s just passing these values that does not.
To send 3 queue items you’ve to call xQueueSend 3 times.
You’ve created the queue for with item size 1 float and depth 3, which means you send/receive 1 float items per call and the queue can hold/buffer max. 3 float items.
See also https://freertos.org/Embedded-RTOS-Queues.html and e.g. xQueueCreate API description.
I actually thought I had made the element size of the queue to be 3 floats with this statement
TemperatureQueue = xQueueCreate(3, sizeof(float));
I didn’t think about iterating over the Queue to fill it.
I had hoped that I could create a struct containing 3 floats and call the XQueueSend only 1 time filling it with the 3 floats… it seemed cleaner / faster
Sure you can send structs. As described in the examples you find following the links already posted. In fact FreeRTOS queues handle any fixed sized binary items or packets you want. Using the docs save a lot of time