Introduction
We set a pin mode to tell the Raspberry Pi if the pin will read signals (input) or send signals (output).
When you want to read a button press from a sensor.
When you want to turn on an LED or motor.
When you connect a switch to detect if it is pressed or not.
When you want to control a device like a buzzer or relay.
When you need to read data from a sensor like a temperature sensor.