TaskHandle_t task1;
TaskHandle_t task2;

// Assign GPIOs pins to LEDs

#define led1 LED_BUILTIN
#define led2 25

const float t1 = 586;
const float t2 = 1200;
const float t3 = 12550;

void setup() {
Serial.begin(115200 );
pinMode( led1, OUTPUT );
pinMode( led2, OUTPUT );
Serial.println( "setup do loop rodando uma única vez: " );
//create a task that will be executed in the Task1code() function, with priority 1 and executed on core 0
xTaskCreatePinnedToCore(task_1code,
"Task1", // name of task.
10000, // Stack size of task
NULL, // parameter of the task
1, // priority of the task
&task1, // Task handle to keep track of created task
1); // pin task to core 1

vTaskDelay(1000);
//create a task that will be executed in the Task2code() function, with priority 1 and executed on core 1
xTaskCreatePinnedToCore(task_2code, //Task function.
"task2", //name of task.
10000, //Stack size of task
NULL, //parameter of the task
1, //priority of the task
&task2, //Task handle to keep track of created task
0); //pin task to core 0
vTaskDelay(1000);
}

//task_1code: blinks an LED every 1000 ms

void task_1code( void * pvParameters )
{
Serial.println( "parte de task1 rodando uma única vez: " );
Serial.print("task1 running on: core ");
Serial.println( xPortGetCoreID() );
Serial.print( " LED_BUILTIN: " );
Serial.print(t2/1000);
Serial.println('s');

for(;;)
  {
  digitalWrite( led1, HIGH);
  vTaskDelay(t2);
  digitalWrite(led1, LOW);
  vTaskDelay(t2);
  }
}

//task_2code: blinks an LED every 500 ms
void task_2code( void * pvParameters )
{
Serial.println( "parte de task2 rodando uma única vez: " );
Serial.print( "task2 running on: core " );
Serial.println(xPortGetCoreID() );
Serial.print( " LED EXTERNO: " );
Serial.print(t1/1000);
Serial.println('s');
for(;;)
  {
  digitalWrite(led2, HIGH );
  vTaskDelay(t1);
  digitalWrite(led2, LOW );
  vTaskDelay(t1);
  }
}

void loop()
{
Serial.print( "loop() is running on: Core " );
Serial.println( xPortGetCoreID() );
Serial.print( " Loop a: " );
Serial.print(t3/1000);
Serial.println('s');
vTaskDelay(t3);
}