মূল বিষয়বস্তুতে যান
Back to Reference
Arduino API

Pin modes: INPUT, OUTPUT, INPUT_PULLUP

What pinMode() does electrically, and which mode to use.

ModeWhat the pin doesUse for
OUTPUTDrives 0 V or the logic voltage (≈20 mA max)LEDs (with resistor), driver inputs, signals
INPUTHigh impedance — reads whatever drives itSensors that drive the line, buttons with external resistors
INPUT_PULLUPInput with an internal resistor to the logic voltageButtons and switches to GND
INPUT_PULLDOWNInput with an internal resistor to GND (ESP32 only)Buttons to 3.3 V
Two outputs connected together, one HIGH and one LOW, short each other. Never wire output pins directly to each other, to GND or to a supply.