When pins have more than one function

the documentation for my board states that pin labeled 14 “Can either be used as ESP8266 GPIO14 or I2C serial clock (SCL).”

I am wondering how the pins adopt the desired functionality.

Does the

pinMode()

do the work to force a pin to be a GPIO instead of (say) SCL/whatever…?

“Special” pins already know their primary function and should just work as needed by default.

Yes, pinMode() should only be needed for “forcing” basic digital I/O to a fixed INPUT, OUTPUT, or INPUT_PULLUP (Not sure if that last one is ESP compatible)

https://www.arduino.cc/reference/en/language/functions/digital-io/pinmode/

Although with some boards like ESP32 then you can use commands to make most any pin do different stuff (OK, not relevant to this topic, but just tossing it out there :stuck_out_tongue_winking_eye: )

1 Like