Untitled
unknown
plain_text
2 years ago
1.0 kB
1
Indexable
Never
void blinkingLed( void *pvParameters __attribute__((unused)) ) // This is a Task. { // Task1: Higher priority (initially) int i; #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. { //Para que parpadee, hay que encenderla Y apagarla. for (int i = 0; i<2; i++) { ledState = 1 - ledState; //ledState es una variable global que guarda el estado de la LED. switch (ledState) { case 1: digitalWrite(LED_BUILTIN, HIGH); //Encender LED Serial.print("La LED se ha apagado."); break; case 0: digitalWrite(LED_BUILTIN, LOW); //Apagar LED Serial.print("La LED se ha apagado."); break; } delay(100); } vTaskPrioritySet(xblinkingLedHandle,0); //reestablecer la prioridad de blinkingled. //Cambiar el valor ledState de 1 a 0 o de 0 a 1. } }