Button / Switch Set the GPIO to input mode with pull-up. Place 100nF capacitor between GPIO and GND. (Optional) Place 10k resistor between GPIO and 3V3.