'Arduino ESP32 FreeRTOS - How to declare empty byte array in task
I have the following FreeRTOS function:
void UARTSendCommand(void *pvParameters)
{
(void) pvParameters;
uint8_t receive[]; //***** NEED TO DO A EMPTY ARRAY
for (;;)
{
xSemaphoreTake(xCountingSemaphore, portMAX_DELAY);
xQueueReceive(queue, &receive, 0);
if(receive)
{
Serial.println("UART Send command received");
uart_write_bytes(UARTNUM, (const char*) receive, sizeof(receive));
}
xSemaphoreGive(xCountingSemaphore);
vTaskDelay(1);
}
}
The Queue is declared as:
UARTSendQueue = xQueueCreate(10, sizeof(char));
And when I send to queue I do this:
byte message[] = {0x5A, 0xA5, 0x05, 0x82, 0x20, 0x00, (gaugeImage >> 8) & 0xFF, gaugeImage & 0xFF };
xSemaphoreTake(xCountingSemaphore, portMAX_DELAY);
xQueueSend(queue, &message, 0);
xSemaphoreGive(xCountingSemaphore);
What I need is to get in my Task function the parameter sent in the queue, but I don't get anything.
Any clue?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
