diff --git a/pages/learn/develop/hardware/gpio.md b/pages/learn/develop/hardware/gpio.md index 1157cb8946..6c026b8cc5 100644 --- a/pages/learn/develop/hardware/gpio.md +++ b/pages/learn/develop/hardware/gpio.md @@ -24,109 +24,6 @@ We recommend [Pi Pins][pi-pins] for node.js projects - we've found it works reli 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. -#### File System Access - -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. - -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`. - -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`. - -Once a pin is exported you need to set its 'direction' - in or out - via `/sys/class/gpio/gpio[pin number]/direction`. - -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. - -E.g. accessing GPIO port 17 and sending some data:- - -```Bash -# ls /sys/class/gpio/gpio17 -ls: cannot access /sys/class/gpio/gpio17: No such file or directory -# echo 17 > /sys/class/gpio/export -# ls /sys/class/gpio/gpio17 -/sys/class/gpio/gpio17 -# echo out > /sys/class/gpio/gpio17/direction -# echo 1 > /sys/class/gpio/gpio17/value -# echo 0 > /sys/class/gpio/gpio17/value -# echo 1 > /sys/class/gpio/gpio17/value -... -# echo 17 > /sys/class/gpio/unexport -# ls /sys/class/gpio/gpio17 -ls: cannot access /sys/class/gpio/gpio17: No such file or directory -``` - -For more details on sysfs GPIO access see the [official kernel documentation][kernel-gpio]. - - - #### Voltage All numbered data pins operate at 3.3v, however there are two 5v ports which output 5v DC output.