在树莓派针脚中,一个数据针脚的常见的状态有输入IN和输出OUT,软pwm等状态,总共所有的状态:
DIGITAL_INPUT(0, "input", PinDirection.IN), DIGITAL_OUTPUT(1, "output", PinDirection.OUT), PWM_OUTPUT(2, "pwm_output", PinDirection.OUT), GPIO_CLOCK(3, "gpio_clock", PinDirection.OUT), SOFT_PWM_OUTPUT(4, "soft_pwm_output", PinDirection.OUT), SOFT_TONE_OUTPUT(5, "soft_tone_output", PinDirection.OUT), PWM_TONE_OUTPUT(6, "pwm_tone_output", PinDirection.OUT), ANALOG_INPUT(998, "analog_input", PinDirection.IN), ANALOG_OUTPUT(999, "analog_output", PinDirection.OUT)
但在实际操控温度湿度dht11模块的时候,遇到一个概念,叫上拉电阻,下拉电阻。这里是什么意思呢?
https://www.founderchip.com/?id=271
什么意思呢?每个引脚,都有一个电阻,上拉电阻和下拉电阻,电阻阻值是50k欧姆。那上拉电阻和下拉电阻的结果是什么呢?
上拉电阻,是使引脚降为GND;上拉是拉到3.3v;还有一个off状态,是无电阻。