to create the second task just call xTaskCreate
twice, like below:
void vTaskLedGreen( void * pvParameters )
{
/* The parameter value is expected to be 1 as 1 is passed in the
pvParameters value in the call to xTaskCreate() below.
configASSERT( ( ( uint32_t ) pvParameters ) == 1 );
for( ;; )
{
vTaskDelay(pdMS_TO_TICKS(1000));
GreenLedOff();
vTaskDelay(pdMS_TO_TICKS(1000));
GreenLedOn();
}
}
void vTaskLedRed( void * pvParameters )
{
/* The parameter value is expected to be 1 as 1 is passed in the
pvParameters value in the call to xTaskCreate() below.
configASSERT( ( ( uint32_t ) pvParameters ) == 1 );
for( ;; )
{
vTaskDelay(pdMS_TO_TICKS(1000));
RedLedOff();
vTaskDelay(pdMS_TO_TICKS(1000));
RedLedOn();
}
}
/* Function that creates a task. */
void main( void )
{
BaseType_t xReturned;
TaskHandle_t xHandle = NULL;
xReturned = xTaskCreate(
vTaskLedRed, /* Function that implements the task. */
"RedLed", /* Text name for the task. */
STACK_SIZE, /* Stack size in words, not bytes. */
( void * ) 1, /* Parameter passed into the task. */
tskIDLE_PRIORITY,/* Priority at which the task is created. */
&xHandle ); /* Used to pass out the created task's handle. */
if( xReturned != pdPASS )
{
ErrorHandler();
}
xReturned = xTaskCreate(
vTaskLedGreen, /* Function that implements the task. */
"GreenLed", /* Text name for the task. */
STACK_SIZE, /* Stack size in words, not bytes. */
( void * ) 1, /* Parameter passed into the task. */
tskIDLE_PRIORITY,/* Priority at which the task is created. */
&xHandle ); /* Used to pass out the created task's handle. */
if( xReturned != pdPASS )
{
ErrorHandler();
}
// Start the real time scheduler.
vTaskStartScheduler();
}