Boot button as GPIO

maxmaxk
Posts: 7
Joined: Mon Jan 29, 2024 6:06 pm

Boot button as GPIO

Postby maxmaxk » Mon Jan 29, 2024 6:16 pm

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.

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: Boot button as GPIO

Postby ESP_Sprite » Tue Jan 30, 2024 12:17 am

On the C6 (and as of the time of writing, all ESP32-Cx chips) the boot button is connected to GPIO9, not GPIO0.

Who is online

Users browsing this forum: No registered users and 131 guests