ESP32 GPIO12
Everything you need to use this pin correctly: status, alternate functions, boot-time cautions and working code.
| Status | Usable |
|---|---|
| Alternate functions | ADC2_CH5TOUCH5HSPI MISOJTAG TDI |
| Chip | ESP32 pinout |
Watch out:
- Strapping pin: its level is latched at power-up to configure boot behaviour. Do not attach anything that changes its reset state.
- This is an ADC2 channel, which becomes unavailable while Wi-Fi is running — use an ADC1 channel for reliable sampling.
Practical notes
Strapping pin (MTDI), also JTAG TDI / HSPI MISO / ADC2_CH5 / TOUCH5. It sets the internal regulator output voltage, so a strong external pull-up can prevent the chip from starting. Prime suspect when a board boots fine empty and dies after flashing.
Sample code
// Arduino
const int PIN = 12;
void setup() {
Serial.begin(115200);
analogReadResolution(12);
// set attenuation before measuring higher voltages
analogSetAttenuation(ADC_11db);
}
void loop() {
int raw = analogRead(PIN);
Serial.println(raw);
delay(1000);
}
Data verified:2026-10-20 · Cross-checked against Espressif documentation. Always confirm against the official datasheet before finalizing a design. Official docs →