Raspberry Pi control and program GPIO

There are many different ways to control and program the GPIOs. Which one is used depends on the requirements one has. Or simply of your own abilities to become familiar with certain programming languages and libraries. Previous knowledge makes getting started easier. But maybe that’s not the way to do what you’re supposed to do with the GPIOs. Therefore, here is a small selection of the possibilities to control and program GPIOs.
- Shell/bash: sysfs
- Shell/Bash: wiringPi
- Shell/Bash: pigpio
Shell / bash: sysfs
On the command line (shell) “sysfs” is available. It belongs to the Raspbian Linux distribution. In principle, it is a directory tree that can be used to address the GPIOs.
Using sysfs is the most obvious way to control the GPIOs. But, it is hardly intuitive to use. Usually you will try to build simplifications yourself or try other solutions.
Shell / Bash: wiringPi
A simplification on the command line is “wiringPi”. Using simple commands, the GPIOs can be controlled and programmed. But, “wiringPi” is a bit older and no longer the preferred way to address GPIOs.
Shell / Bash: pigpio
A simplification on the command line is “pigpio”. It’s also the preferred way to easily control and program GPIOs on the command line.
GPIO assignment
No matter how you program the GPIOs, there is always the same problem. Which numbering system is used to control the individual GPIOs? Is the GPIO number (BCM) used? Or is the pin number used? Both are not identical and are often confused by beginners. Which numbering system one uses does not really matter. The easy way goes over the pin number, because then you just have to count in case of doubt. This also simplifies the wiring. However, the GPIO number (BCM) tends to be recommended because it determines which GPIO is meant.
Leave a Reply