Electrical engineering · also Computer engineering
Digital input and output
General-purpose input/output pins, or GPIO, are a microcontroller's simplest connection to the world. Configured as an output, a pin is driven high or low and can switch an LED through a resistor, as long as its current limit is respected. Configured as an input, it reads whether a voltage is high or low. A button needs a pull-up or pull-down resistor so the input has a defined level when the button is open. Mechanical contacts also bounce, briefly opening and closing many times, so firmware debounces them to register one clean press.
Why it mattersA robot's bump switches and limit switches are read through GPIO inputs, and a missed or doubled press can stop a joint in the wrong place.