boolean do_once = true;
//Task and Queue handlers
TaskHandle_t Task1; //LED1
TaskHandle_t Task2; //LED2
TaskHandle_t Task3; //LED3
TaskHandle_t Task4; //LED4
TaskHandle_t Task5; //LED5

//declarations of Task related functions
static void Task1code( void * parameter);
static void Task2code( void * parameter);
static void Task3code( void * parameter);
static void Task4code( void * parameter);
static void Task5code( void * parameter);

void setup() {
  Serial.begin(115200);
  Serial.println("Running");
  vTaskDelay(1000 / portTICK_PERIOD_MS); //wait for a second
  pinMode(23, OUTPUT);
  pinMode(22, OUTPUT);
  pinMode(21, OUTPUT);
  pinMode(19, OUTPUT);
  pinMode(18, OUTPUT);

  xTaskCreatePinnedToCore(
    Task1code,   /* Task function. */
    "Task1",     /* name of task. */
    2048,       /* Stack size of task */
    NULL,        /* parameter of the task */
    1,           /* priority of the task */
    &Task1,      /* Task handle to keep track of created task */
    NULL);          /* pin task to core 1 */

  xTaskCreatePinnedToCore(
    Task2code,   /* Task function. */
    "Task2",     /* name of task. */
    2048,       /* Stack size of task */
    NULL,        /* parameter of the task */
    1,           /* priority of the task */
    &Task2,      /* Task handle to keep track of created task */
    NULL);          /* pin task to core 0 */

  xTaskCreatePinnedToCore(
    Task3code,   /* Task function. */
    "Task3",     /* name of task. */
    2048,       /* Stack size of task */
    NULL,        /* parameter of the task */
    1,           /* priority of the task */
    &Task3,      /* Task handle to keep track of created task */
    NULL);          /* pin task to core 1 */

  xTaskCreatePinnedToCore(
    Task4code,   /* Task function. */
    "Task4",     /* name of task. */
    2048,       /* Stack size of task */
    NULL,        /* parameter of the task */
    1,           /* priority of the task */
    &Task4,      /* Task handle to keep track of created task */
    NULL);          /* pin task to core 0 */
  xTaskCreatePinnedToCore(
    Task5code,   /* Task function. */
    "Task5",     /* name of task. */
    2048,       /* Stack size of task */
    NULL,        /* parameter of the task */
    1,           /* priority of the task */
    &Task5,      /* Task handle to keep track of created task */
    NULL);          /* pin task to core 0 */
}

void loop() {
  if(do_once){
    do_once = false;
Serial.println("Loop task running on Core: " + String(xPortGetCoreID()));
  }

}

static void Task1code( void * parameter) {
  Serial.println("Task 1 running on Core: " + String(xPortGetCoreID()));
  while (1) {
    digitalWrite(23, HIGH);
    delay(500);
    digitalWrite(23, LOW);
    delay(500);
  }
  vTaskDelete(NULL);
}

static void Task2code( void * parameter) {
  Serial.println("Task 2 running on Core: " + String(xPortGetCoreID()));
  while (1) {
    digitalWrite(22, HIGH);
    delay(500);
    digitalWrite(22, LOW);
    delay(500);
  }
  vTaskDelete(NULL);
}

static void Task3code( void * parameter) {
  Serial.println("Task 3 running on Core: " + String(xPortGetCoreID()));
  while (1) {
    digitalWrite(21, HIGH);
    delay(500);
    digitalWrite(21, LOW);
    delay(500);
  }
  vTaskDelete(NULL);
}

static void Task4code( void * parameter) {
  Serial.println("Task 4 running on Core: " + String(xPortGetCoreID()));
  while (1) {
    digitalWrite(19, HIGH);
    delay(500);
    digitalWrite(19, LOW);
    delay(500);
  }
  vTaskDelete(NULL);
}

static void Task5code( void * parameter) {
  Serial.println("Task 5 running on Core: " + String(xPortGetCoreID()));
  while (1) {
    digitalWrite(18, HIGH);
    delay(500);
    digitalWrite(18, LOW);
    delay(500);
  }
  vTaskDelete(NULL);
}