Introduction
We set a pin as input or output to control if it reads signals or sends signals in a circuit.
When you want to read a button press (input).
When you want to turn on an LED (output).
When you connect sensors that send data to the microcontroller (input).
When you want to control motors or buzzers (output).
When you need to switch between reading and sending signals on the same pin.