GPIO Problems - Functions don't seem to work (ESP-IDF v5.3.1)
Posted: Fri Jan 03, 2025 10:35 pm
Hello,
I've been scratching my head over the past few hours and stumped. I didn't think it would be this trivial and wondered if anyone else was encountering the same problem. I am down to the basics and still can't get it to work.
The above code toggles the gpio from high to low but in my case the gpio stays low.
esp32 pinout reference: https://randomnerdtutorials.com/esp32-p ... nce-gpios/
Any suggestions would be greatly appreciated.
I've been scratching my head over the past few hours and stumped. I didn't think it would be this trivial and wondered if anyone else was encountering the same problem. I am down to the basics and still can't get it to work.
Code: Select all
static void i2c_0_task( void *pvParameters ) {
// initialize the xLastWakeTime variable with the current time.
TickType_t xLastWakeTime = xTaskGetTickCount ();
//
//
uint8_t gpio_pin = GPIO_NUM_13;
gpio_reset_pin(gpio_pin);
esp_rom_gpio_pad_select_gpio(gpio_pin);
gpio_set_direction(gpio_pin, GPIO_MODE_OUTPUT);
//
// task loop entry point
for ( ;; ) {
if(gpio_get_level(gpio_pin) == 1) {
gpio_set_level(gpio_pin, 0);
} else {
gpio_set_level(gpio_pin, 1);
}
ESP_LOGI(APP_TAG, "GPIO %d: %d", gpio_pin, gpio_get_level(gpio_pin));
//
//
// pause the task per defined wait period
vTaskDelaySecUntil( &xLastWakeTime, 5 );
}
//
// free up task resources and remove task from stack
vTaskDelete( NULL );
}
esp32 pinout reference: https://randomnerdtutorials.com/esp32-p ... nce-gpios/
Any suggestions would be greatly appreciated.