GPIO
板上有兩個(gè)5V引腳和兩個(gè)3.3V引腳,以及一些不可配置的接地引腳(0V)。其余引腳都是通用3.3V引腳,意味著輸出設(shè)置為3.3V,輸入為3.3V容差。
OUTPUTS
指定為輸出引腳的GPIO引腳可以設(shè)置為高電平(3.3V)或低電平(0V)。
INPUTS
指定為輸入引腳的GPIO引腳可以讀取為高電平(3.3V)或低電平(0V)。使用內(nèi)部上拉或下拉電阻更容易做到這一點(diǎn)。引腳GPIO2和GPIO3具有固定的上拉電阻,但對(duì)于其他引腳,這可以在軟件中配置。
MORE
除了簡(jiǎn)單的輸入和輸出設(shè)備,GPIO引腳還可以用于各種替代功能,有些可用于所有引腳,有些可用于特定引腳。
PWM (脈沖寬度調(diào)制)
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)
Data: (GPIO2); Clock (GPIO3)
EEPROM Data: (GPIO0); EEPROM Clock (GPIO1)
Serial
TX (GPIO14); RX (GPIO15)
有關(guān)GPIO引腳高級(jí)功能的更多信息,請(qǐng)參見interactive pinout diagram
raspi-gpio
raspi-gpio是一個(gè)在樹莓派上使用的GPIO控制工具,可以獲取GPIO狀態(tài)以及設(shè)置GPIO
安裝
sudo apt -y install raspi-gpio
使用說明
Use:
raspi-gpio get [GPIO]
OR
raspi-gpio set [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功能及復(fù)用功能表
轉(zhuǎn)載來自:https://rpideveloper.com/topic/34/gpio
-
物聯(lián)網(wǎng)
+關(guān)注
關(guān)注
2912文章
44915瀏覽量
375946 -
工控機(jī)
+關(guān)注
關(guān)注
10文章
1753瀏覽量
50743 -
GPIO
+關(guān)注
關(guān)注
16文章
1216瀏覽量
52287 -
樹莓派
+關(guān)注
關(guān)注
117文章
1710瀏覽量
105808
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
評(píng)論