Untitled
unknown
plain_text
2 years ago
1.1 kB
1
Indexable
Never
void TaskPriority( void *pvParameters __attribute__((unused)) ) // This is a Task. { #if defined(__ESP32__) esp_task_wdt_init(30, false); // Disable the HW watchdog for 30 seconds, only for ESPRESSIF BOARDS (ESP32) #endif for (;;) // A Task shall never return or exit. { // read the input pin: int buttonState = digitalRead(pushButton); if (buttonState==1){ PriorityTask1 = 1; PriorityTask2 = 2; } else { PriorityTask1 = 2; PriorityTask2 = 1; } if (loopcount % 5 != 0) { vTaskPrioritySet(xTask1Handle, PriorityTask1); vTaskPrioritySet(xTask2Handle, PriorityTask2); vTaskPrioritySet(xblinkingLedHandle, PriorityblinkingLed); } else { //darle mayor prioridad a la tarea blinkingled. vTaskPrioritySet(xTask1Handle, 1); vTaskPrioritySet(xTask2Handle, 1); vTaskPrioritySet(xblinkingLedHandle, 2); } loopcount++; //aumentar el contador de vueltas en 1 vTaskDelay(1000); // one tick delay == 1ms } }