#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#define BUTTON_PIN GPIO_NUM_26
#define LED_PIN GPIO_NUM_14
void app_main(void)
{
// Configurar botón como entrada SIN pull-up ni pull-down interno
gpio_set_direction(BUTTON_PIN, GPIO_MODE_INPUT);
gpio_set_pull_mode(BUTTON_PIN, GPIO_FLOATING); // Tu circuito ya tiene pull-down
// Configurar LED como salida
gpio_set_direction(LED_PIN, GPIO_MODE_OUTPUT);
while (1) {
int estado_boton = gpio_get_level(BUTTON_PIN);
// Enciende el LED si el botón está en nivel ALTO
gpio_set_level(LED_PIN, estado_boton == 1 ? 1 : 0);
vTaskDelay(pdMS_TO_TICKS(10));
}
}