ESP32 i2c Gyroscope with FreeRTOS

I am using an ESP32 and an Embeddio SNAP Board equipped with a L3GD20 Gyroscope.

What I want is to send the values from the sensor via the ESP32.

Do I have to create two separate tasks (one for reading out values and then passing to another task and then send it) or one task that reads in the Gyroscope values and immediately sends it?

This is very dependent on the requirements of your system and what ‘send it’ involves. If you want to send a continuous stream then it might be that neither option is optimal. For example, you could read the gyro from an interrupt, then each time the interrupt service routine executes with a new reading you pass the value to a DMA (or FIFO, or whatever the hardware provides) for transmission. That would be fast with minimal processor load Vs the rate of transmission.

On the other extreme, if you don’t need to transmit the data at maximum speed or at a regular frequency, you could just have a low priority background task that polls the Gyro for a new value, sends the value, then returns to poll for a new value once the data has been sent.

So there is no single answer without knowing how the gyro is connected, how the data is transmitted, and what the application requirements.