Raspberry Pi GPIO Zero

For simple (and not so simple) IO control on the Pi without worrying about access control and SUDO etc. all of which can get in the way of having fun, you can use the GPIO Zero library and API – rather than go into detail I’ll refer you to the Raspberry Pi site..

https://www.raspberrypi.org/blog/gpio-zero-a-friendly-python-api-for-physical-computing/

Examples of use:

https://www.raspberrypi.org/documentation/usage/gpio/python/README.md

Reference:

https://gpiozero.readthedocs.io/en/stable/

That lot covers everything from simple IO to SPI, I2c and serial. What more could you want (yes, I know, drivers for every device on the planet). I’ve played with PWM and digital LED output which works as you’d expect.

I’m on a roll now and having turned on SPI (SPI0 and SPI1) with the command line RASPI-CONFIG, I’ve just installed SPI-DEV (https://pypi.org/project/spidev/) using:

sudo pip install spi-dev

There are several libraries out there for driving various displays… and so now, adding displays and buttons to the PI gets very simple.