Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

How to use GPIOs

143 bytes added, 16:59, 22 September 2015
no edit summary
Basic gpio operations could be done using bash and sysfs :
* Export GPIOs <pre>echo "GPIO number NN" > /sys/class/gpio/export</pre>
** For example: '''echo "156" > /sys/class/gpio/export'''<br><br>
* Unexport GPIOs <pre>echo "GPIO number NN" > /sys/class/gpio/unexport</pre>
* Set GPIO direction <pre>echo "out" > /sys/class/gpio/gpioNN/direction</pre>
** For example: '''echo "out" > /sys/class/gpio/gpio156/direction'''<br><br>
* Set GPIO value <pre>echo "1" > /sys/class/gpio/gpioNN/value</pre>
* Get GPIO value <pre>cat /sys/class/gpio/gpioNN/value</pre>