GPIO LED - HerbFargus/Raspberry-Pi-Scripts GitHub Wiki

There are endless projects that can utilise the GPIO pins on a Raspberry Pi, this has a few simple examples on how to work with LED's on the GPIO pins.

The main package we'll be using is GPIO Zero

Dependencies:

sudo apt-get install python-gpiozero python3-gpiozero

Creating python scripts:

nano yourpythonscript.py

Blink LED:

from gpiozero import LED
from signal import pause

red = LED(17)

red.blink()

pause()

Fade LED:

from gpiozero import PWMLED
from signal import pause

led = PWMLED(17)

led.pulse()

pause()

Creating a dialog gui to run python scripts:

https://unix.stackexchange.com/questions/155636/dialog-menu-to-display-files-and-select-one-of-them

and

https://github.com/folkien/scripts/blob/493bff8f2ff8abc2344d6a99d75d8e21505fdf89/filelist.sh

https://pastebin.com/2cFgBdjb