1、GPIO編碼的方法
- 第三列是樹莓派板子上的自然編號(左邊引腳為1-15,右邊引腳為2-26),
RPi.GPIO.setmode(GPIO.BOARD)
采用這列編號 - 樹莓派主芯片提供商Broadcom的編號方法,相當於調用了
WiringPiSetupGpio()
或RPi.GPIO.setmode(GPIO.BCM)
采用這列編號
wiringPi Pin | Name | Board Pin | BCM GPIO |
0 | GPIO 0 | 11 | 17 |
1 | GPIO 1 | 12 | 18 |
2 | GPIO 2 | 13 | 21 |
3 | GPIO 3 | 15 | 22 |
4 | GPIO 4 | 16 | 23 |
5 | GPIO 5 | 18 | 24 |
6 | GPIO 6 | 22 | 25 |
7 | GPIO 7 | 7 | 4 |
8 | SDA | 3 | 0 |
9 | SCL | 5 | 1 |
10 | CE0 | 24 | 8 |
11 | CE1 | 26 | 7 |
12 | MOSI | 19 | 10 |
13 | MISO | 21 | 9 |
14 | SCLK | 23 | 11 |
15 | TXD | 8 | 14 |
16 | RXD | 10 | 15 |
Rev.2 新增的引腳:
wiringPi Pin | Name | Board Pin | BCM GPIO |
17 | GPIO 8 | 28 | |
18 | GPIO 9 | 29 | |
19 | GPIO10 | 30 | |
20 | GPIO11 | 31 |
2、GPIO的電氣特性
Also from the wiki the "maximum permitted current draw from the 3v3 pin is 50mA" and the "maximum permitted current draw from the 5v pin is the USB input current (usually 1A) minus any current draw from the rest of the board." The current draw for Model B is stated as 700mA so with a 1A power supply this leaves about 300mA to play with.
對於3.3伏的線路科承受的電流上限是50mA,對於5V的是700mA,
There will also be an issue with trying to draw to much power form the pins, according to the data-sheet each pin programmed to current drive between 2mA and 16mA, and it has been warned that trying to draw 16mA from several pins at once could also lead to a damaged Pi.
對於其他針腳可承受的上限是16mA,對3.3V的話至少要接入210歐的元器件總電阻。