Digital Input/Output
In electrical circuits, when a switch is closed (closed circuit), current flows, and when the switch is opened (open circuit), electricity does not flow.

Digital input and output of controllers are fundamentally the same as the above circuit, where the closed state is called HIGH and the open state is called LOW.
Digital Input
In digital input, the controller detects whether the circuit is open or closed based on the operation of an external switch. When the circuit is closed, it recognizes it as HIGH, and when it’s open, it recognizes it as LOW.

Digital Output
In digital output, the controller controls the opening/closing of the switch. Therefore, when HIGH needs to be output, the switch is closed, and when LOW needs to be output, the switch is opened.

Example
Examples of digital input and output on Raspberry Pi are shown below.
