Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void TaskLoop0( void *pvParameters );
- void TaskLoop1( void *pvParameters );
- void setup() {
- Serial.begin(115200);
- xTaskCreatePinnedToCore(
- TaskLoop0 // Função que deve ser chamada
- , "TaskLoop0" // Nome da tarefa (para depuração)
- , 1024 // Tamanho da pilha (bytes) // This stack size can be checked & adjusted by reading the Stack Highwater
- , NULL // Parâmetro para passar
- , 2 // Identificador de tarefa (0 baixa, 3 alta)
- , NULL // Identificador de tarefa
- , 0); // Nucleo da Tarefa
- xTaskCreatePinnedToCore(
- TaskLoop1 // Função que deve ser chamada
- , "TaskLoop1" // Nome da tarefa (para depuração)
- , 1024 // Tamanho da pilha (bytes) // This stack size can be checked & adjusted by reading the Stack Highwater
- , NULL // Parâmetro para passar
- , 2 // Identificador de tarefa (0 baixa, 3 alta)
- , NULL // Identificador de tarefa
- , 1); // Nucleo da Tarefa
- }
- void loop(){} // Função padrão, "loop", vazia.
- void TaskLoop0(void *pvParameters)
- {
- (void) pvParameters;
- pinMode(2, OUTPUT);
- for (;;) // A Task shall never return or exit.
- {
- digitalWrite(2, HIGH); // turn the LED on (HIGH is the voltage level)
- vTaskDelay(100); // one tick delay (15ms) in between reads for stability
- digitalWrite(2, LOW); // turn the LED off by making the voltage LOW
- vTaskDelay(100); // one tick delay (15ms) in between reads for stability
- }
- }
- void TaskLoop1(void *pvParameters) // This is a task.
- {
- (void) pvParameters;
- for (;;)
- {
- // read the input on analog pin A3:
- int sensorValueA3 = analogRead(A3);
- // print out the value you read:
- Serial.println(sensorValueA3);
- vTaskDelay(10); // one tick delay (15ms) in between reads for stability
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement