Using GPIOs with scripting languages
Having the possibility to manage the GPIO lines in a scripting language in an easy manner allows us to have a powerful tool to speed up simple tasks involving these peripherals. That's why in this section, we're going to see how the GPIO lines can be managed in both PHP and Python scripting languages in a manner similar to what we did in C.
However, in order to keep the code simple, we suppose that the GPIO lines gpio24
and gpio91
have been exported in some way already. For example, we can properly set them up with the following well-known commands:
root@wb:~# echo 24 > /sys/class/gpio/export root@wb:~# echo in > /sys/class/gpio/gpio24/direction root@wb:~# echo falling > /sys/class/gpio/gpio24/edge root@wb:~# ...
Get GNU/Linux Rapid Embedded Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.