Semaphores are typically used for both synchronization and mutual exclusion in access to resources.
Semaphore example
#include "semphr.h"
//Create semphore
SemaphoreHandle_t SemaphoreHandle1 = NULL;
SemaphoreHandle1 = xSemaphoreCreateMutex();
//Use sempahore
xSemaphoreTake(SemaphoreHandle1, portMAX_DELAY);
//Do something...
xSemaphoreGive(SemaphoreHandle1);
