You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/learn/develop/hardware/gpio.md
-103Lines changed: 0 additions & 103 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,109 +24,6 @@ We recommend [Pi Pins][pi-pins] for node.js projects - we've found it works reli
24
24
25
25
There are also specialist libraries available for powering particular classes of devices via GPIO, e.g. the [MAX7219 node library][max7219] for [MAX7219][max7219] LED displays.
26
26
27
-
#### File System Access
28
-
29
-
You can use the file system directly to access GPIO pins using a [terminal][terminal] connection, scripts deployed to your Pi, or the file system interface of your programming environment.
30
-
31
-
GPIO pins are exposed via the Linux [sysfs][sysfs] file system at `/sys/class/gpio/gpio[pin number]`, e.g. pin 17 would be accessible via `/sys/class/gpio/gpio17`.
32
-
33
-
In order to gain access to a pin it first has to be exported - you can do this by outputting the desired pin number to `/sys/class/gpio/export`. You can later 'unexport' this GPIO pin by outputting this number to `/sys/class/gpio/unexport`.
34
-
35
-
Once a pin is exported you need to set its 'direction' - in or out - via `/sys/class/gpio/gpio[pin number]/direction`.
36
-
37
-
From then on you can output raw data to `/sys/class/gpio/gpio[pin number]/value` bit-by-bit - 0 is interpreted as a low signal, 1 or any other non-zero value is interpreted as a high signal.
38
-
39
-
E.g. accessing GPIO port 17 and sending some data:-
40
-
41
-
```Bash
42
-
# ls /sys/class/gpio/gpio17
43
-
ls: cannot access /sys/class/gpio/gpio17: No such file or directory
44
-
# echo 17 > /sys/class/gpio/export
45
-
# ls /sys/class/gpio/gpio17
46
-
/sys/class/gpio/gpio17
47
-
# echo out > /sys/class/gpio/gpio17/direction
48
-
# echo 1 > /sys/class/gpio/gpio17/value
49
-
# echo 0 > /sys/class/gpio/gpio17/value
50
-
# echo 1 > /sys/class/gpio/gpio17/value
51
-
...
52
-
# echo 17 > /sys/class/gpio/unexport
53
-
# ls /sys/class/gpio/gpio17
54
-
ls: cannot access /sys/class/gpio/gpio17: No such file or directory
55
-
```
56
-
57
-
For more details on sysfs GPIO access see the [official kernel documentation][kernel-gpio].
58
-
59
-
<!-- ### Pin Layout
60
-
61
-
GPIO pin numberings are listed below for all released models of the Raspberry Pi:-
62
-
63
-
__Note:__ The tables below assume your Pi is orientated as shown in the diagram above - the SD card should be at the top of the Pi and the ethernet port at the bottom. GND refers to ground pins.
64
-
65
-
__Note:__ If you have a 26-pin device, it's almost certainly a Raspberry Pi B rev2.
66
-
67
-
### Raspberry Pi B Rev 1
68
-
69
-
| Left |Right|
70
-
|------|-----|
71
-
| 3.3v | 5v |
72
-
| 0 | 5v |
73
-
| 1 | GND |
74
-
| 4 | 14 | (IMPORTANT: GPIO4 unavailable)
75
-
| GND | 15 |
76
-
| 17 | 18 |
77
-
| 21 | GND |
78
-
| 22 | 23 |
79
-
| 3.3v | 24 |
80
-
| 10 | GND |
81
-
| 9 | 25 |
82
-
| 11 | 8 |
83
-
| GND | 7 |
84
-
85
-
### Raspberry Pi A/B Rev 2
86
-
87
-
| Left |Right|
88
-
|------|-----|
89
-
| 3.3v | 5v |
90
-
| 2 | 5v |
91
-
| 3 | GND |
92
-
| 4 | 14 | (IMPORTANT: GPIO4 unavailable)
93
-
| GND | 15 |
94
-
| 17 | 18 |
95
-
| 27 | GND |
96
-
| 22 | 23 |
97
-
| 3.3v | 24 |
98
-
| 10 | GND |
99
-
| 9 | 25 |
100
-
| 11 | 8 |
101
-
| GND | 7 |
102
-
103
-
### Raspberry Pi B+ / Raspberry Pi 2
104
-
105
-
| Left |Right|
106
-
|------|-----|
107
-
| 3.3v | 5v |
108
-
| 2 | 5v |
109
-
| 3 | GND |
110
-
| 4 | 14 | (IMPORTANT: GPIO4 unavailable)
111
-
| GND | 15 |
112
-
| 17 | 18 |
113
-
| 27 | GND |
114
-
| 22 | 23 |
115
-
| 3.3v | 24 |
116
-
| 10 | GND |
117
-
| 9 | 25 |
118
-
| 11 | 8 |
119
-
| GND | 7 |
120
-
| --- | --- |
121
-
| 5 | GND | (IMPORTANT: GPIO5 unavailable)
122
-
| 6 | 12 |
123
-
| 13 | GND |
124
-
| 19 | 16 |
125
-
| 26 | 20 |
126
-
| GND | 21 |
127
-
128
-
__Note:__ The '---' pins between GND/7 and 5/GND are reserved for ID EEPROM and should not be used for GPIO ([reference][eeprom-diag]) -->
129
-
130
27
#### Voltage
131
28
132
29
All numbered data pins operate at 3.3v, however there are two 5v ports which output 5v DC output.
0 commit comments