While you can define the pin properties in the software, some pins are pre-assigned by default, as illustrated in the figure below (this example pertains to the ESP32 DEVKIT V1 DOIT board with 36 pins – note that pin locations may vary by manufacturer).
Furthermore, certain pins have specific characteristics that make them more or less suitable for particular projects. The table below indicates which pins are best for use as inputs, outputs, and which ones require caution.
Pins highlighted in green are safe to use. Those in yellow are generally fine but may behave unexpectedly, especially during boot. Pins in red are not recommended for use as inputs or outputs.
GPIO | Input | Output | Notes |
0 | pulled up | OK | outputs PWM signal at boot, must be LOW to enter flashing mode |
1 | TX pin | OK | debug output at boot |
2 | OK | OK | connected to on-board LED, must be left floating or LOW to enter flashing mode |
3 | OK | RX pin | HIGH at boot |
4 | OK | OK | |
5 | OK | OK | outputs PWM signal at boot, strapping pin |
6 | x | x | connected to the integrated SPI flash |
7 | x | x | connected to the integrated SPI flash |
8 | x | x | connected to the integrated SPI flash |
9 | x | x | connected to the integrated SPI flash |
10 | x | x | connected to the integrated SPI flash |
11 | x | x | connected to the integrated SPI flash |
12 | OK | OK | boot fails if pulled high, strapping pin |
13 | OK | OK | |
14 | OK | OK | outputs PWM signal at boot |
15 | OK | OK | outputs PWM signal at boot, strapping pin |
16 | OK | OK | |
17 | OK | OK | |
18 | OK | OK | |
19 | OK | OK | |
21 | OK | OK | |
22 | OK | OK | |
23 | OK | OK | |
25 | OK | OK | |
26 | OK | OK | |
27 | OK | OK | |
32 | OK | OK | |
33 | OK | OK | |
34 | OK | input only | |
35 | OK | input only | |
36 | OK | input only | |
39 | OK | input only |