▲ 2 r/esp32
Help please, can't get on-board LED to blink, this is my code. Uncommenting the printf statements makes the LED blink. Can you please help me understand what's going on and how I can fix it?
void app_main(void) {
// Resets any previous state of the pin (good practice)
gpio_reset_pin(LED_GPIO);
// Configure GPIO2 as output
gpio_set_direction(LED_GPIO, GPIO_MODE_OUTPUT);
// Blink forever
while (1) {
gpio_set_level(LED_GPIO, 1); // Set pin(GPIO2 in this case) to HIGH(3.3V)
// printf("LED ON\n");
vTaskDelay(pdMS_TO_TICKS(1000));
gpio_set_level(LED_GPIO, 0); // Set pin(GPIO2 in this case) to LOW(0V)
// printf("LED OFF\n");
vTaskDelay(pdMS_TO_TICKS(1000));
}
}
u/sh_pa_ic_rk_ie_tr — 22 hours ago