GPIO
板上有两个5V引脚和两个3.3V引脚,以及一些不可配置的太平洋xg111xg111企业邮局接地引脚(0V)v3.0.1.34苹果版。其余引脚都是太平洋在线xg111通
用3.3V引脚,意味着输出设置为3.3V,输入为3.3V容差v3.0.1.34苹果版。
OUTPUTS
指定为输出引脚的GPIO引脚可以设置为高电平(3.3V)或低电平(0V)v3.0.1.34苹果版。
INPUTS
指定为输入引脚的GPIO引脚可以读取为高电平(3.3V)或低电平(0V)v3.0.1.34苹果版。使用内部上拉或下拉电阻更容易做到这一点。引脚GPIO2和GPIO3具有固定的上拉电阻,但对于其他引脚,这可以在软件中配置。
MORE
除了简单的输入和输出设备,GPIO引脚还可以用于各种替代功能,有些可用于所有引脚,有些可用于特定引脚v3.0.1.34苹果版。
PWM (脉冲宽度调制)
Software PWM available on all pins
Hardware PWM available on GPIO12, GPIO13, GPIO18, GPIO19
SPI
SPI0: MOSI (GPIO10); MISO (GPIO9); SCLK (GPIO11); CE0 (GPIO8), CE1 (GPIO7)
SPI1: MOSI (GPIO20); MISO (GPIO19); SCLK (GPIO21); CE0 (GPIO18); CE1 (GPIO17); CE2 (GPIO16)
I2C
Data: (GPIO2); Clock (GPIO3)
EEPROM Data: (GPIO0); EEPROM Clock (GPIO1)
Serial
TX (GPIO14); RX (GPIO15)
有关GPIO引脚高级功能的更多信息v3.0.1.34苹果版,请参见interactive pinout diagram
raspi-gpio
raspi-gpio是一个在树莓派上使用的GPIO控制工具v3.0.1.34苹果版,可以获取GPIO状态以及设置GPIO
安装
sudo apt -y install raspi-gpio
使用说明
Use:
raspi-gpio get [GPIO]
OR
展开全文
raspi-gpio set <GPIO> [options]
OR
raspi-gpio funcs [GPIO]
OR
raspi-gpio raw
GPIO is a comma-separated list of pin numbers or ranges (without spaces),
e.g. 4 or 18-21 or 7,9-11
Note that omitting [GPIO] from raspi-gpio get prints all GPIOs.
raspi-gpio funcs will dump all the possible GPIO alt funcions in CSV format
or if [GPIO] is specified the alternate funcs just for that specific GPIO.
Valid [options] for raspi-gpio set are:
ip set GPIO as input
op set GPIO as output
a0-a5 set GPIO to alternate function alt0-alt5
pu set GPIO in-pad pull up
pd set GPIO pin-pad pull down
pn set GPIO pull none (no pull)
dh set GPIO to drive to high (1) level (only valid if set to be an output)
dl set GPIO to drive low (0) level (only valid if set to be an output)
Examples:
raspi-gpio get Prints state of all GPIOs one per line
raspi-gpio get 20 Prints state of GPIO20
raspi-gpio get 20,21 Prints state of GPIO20 and GPIO21
raspi-gpio set 20 a5 Set GPIO20 to ALT5 function (GPCLK0)
raspi-gpio set 20 pu Enable GPIO20 ~50k in-pad pull up
raspi-gpio set 20 pd Enable GPIO20 ~50k in-pad pull down
raspi-gpio set 20 op Set GPIO20 to be an output
raspi-gpio set 20 dl Set GPIO20 to output low/zero (must already be set as an output)
raspi-gpio set 20 ip pd Set GPIO20 to input with pull down
raspi-gpio set 35 a0 pu Set GPIO35 to ALT0 function (SPI_CE1_N) with pull up
raspi-gpio set 20 op pn dh Set GPIO20 to ouput with no pull and driving high
GPIO功能及复用功能表
转载来自:
:树莓派开发者