Page 1 of 1

Boot button as GPIO

Posted: Mon Jan 29, 2024 6:16 pm
by maxmaxk
In this example, https://github.com/espressif/esp-idf/bl ... ain.c#L101 it seems GPIO0 is used as a button and when it is pressed, mqtt publishes something.
My problem is that it is not working on my official ESP-C6 devkit. I read somewhere that the boot button is connected to GPIO0, and I don't have to do anything special to use it as GPIO0.

Code: Select all

#define EXAMPLE_BUTTON_GPIO     0
static void check_button(void* args)
{
    static bool old_level = true;
    bool new_level;
    bool run_check_button = true;
    initialise_button();
    while (run_check_button) {
        new_level = gpio_get_level(EXAMPLE_BUTTON_GPIO);
My devkit information is here: https://docs.espressif.com/projects/esp ... guide.html

I tried to change

Code: Select all

#define EXAMPLE_BUTTON_GPIO     0
to

Code: Select all

#define EXAMPLE_BUTTON_GPIO     8
as schematics in this page suggests, but not hope.

Re: Boot button as GPIO

Posted: Tue Jan 30, 2024 12:17 am
by ESP_Sprite
On the C6 (and as of the time of writing, all ESP32-Cx chips) the boot button is connected to GPIO9, not GPIO0.