Digital input and output are the most commonly used external communication methods, although each port only has two states, 0 and 1, they can be combined to create various changes.

Principles of Digital Input and Output

Digital input and output, also known as general purpose input/output, is commonly referred to as GPIO

The function of GPIO mainly refers to the fact that this pin can be used as an input or output for digital signals. Whether it is an input or an output requires us to use system registers for configuration.

When GPIO is set to input mode, the voltage level on this pin can be read to achieve the function of reading external signals, such as signals from external buttons.

When GPIO is set to output mode, we can actively change the voltage level of the pins, so that we can control external devices through the change in voltage level, such as turning on or off an LED light.

In addition, some IO ports can also be configured for other functions, such as PWM output, serial communication, and so on.

类似文章