Here’s what I do to initialise an ESP-01 port bit GPIO0 as an output.
Firstly the setup..
// For GPIO2 just change the 0 to 2 - there is one init line.
#define LED_GPIO 0
#define LED_GPIO_MUX PERIPHS_IO_MUX_GPIO0_U
#define LED_GPIO_FUNC FUNC_GPIO0
and here it is set to 1.
As you can see, I’ve already figured out how to do the same with GPIO2 (though I’ve not used GPIO2 as an output yet)
So – what other pins can we use in exactly the same way and are the numbers as you would expect or different?? This general principle also seems to work for GPO4 and 5 but not for the higher numbers.