In the previous six articles, we’ve covered the basics of RPi.GPIO. I hope the series has been useful.

While I was doing the “recap” for part 6, I decided to make myself a quick reference “cheat sheet” with all the common RPi.GPIO stuff in it. I figured this would be useful and save me having to look things up on the web and in previous Python scripts I’ve written. I made it as a text file that I can just copy and paste snippets of code from to make RPi.GPIO Python coding easier.

Then I realised that it would make a perfect part 7 to round off the series – along with links to the more advanced RPi.GPIO tutorials on interrupts and PWM that I published back in April. So here it is…

Thanks Ben

No series on RPi.GPIO would be complete without a big thank you to RPi.GPIO author Ben Croston. Thank you for all your hard work on making it easy for us to control the world with GPIO on our Raspberry Pis. The official RPi.GPIO documentation is found here.

I’ve got Python code below. It works and appropriately lights up the LED’s on my breadboard depending on if the sensors are activated or not.
My starting point wasn’t these articles … it uses gpiozero.

“from gpiozero import LED, Button, MotionSensor”

—-SNIP—-

You are calling “import RPi.GPIO as GPIO”. – This seems to operate at a much lower layer…

The question(s)
… I’m wondering if gpiozero … although it works… is intended for the Raspberry Pi Zero?… and that I should actually be using RPi.GPIO
… and my actual question… is there something I should be reading to understand what these libraries (if that’s what they are called) are intended for?

GPIO zero is not intended for Pi Zero, it is intended for all Pi and is meant to be easy to use.
It’s like a layer on top of RPi.GPIO if you like, although I think it no longer depends on RPi.GPIO, it did when it first came out.

It’s simple. GPIO Zero is for beginners and education. It’s easy to use and remember.
RPi.GPIO is slightly ‘lower level’ and gives you a bit more direct control. But it’s not a great deal harder to use for simple port switching.