Skip to content

Instantly share code, notes, and snippets.

@johnwargo
johnwargo / relay-test.py
Last active Nov 19, 2020
Simple Python app for controlling a relay through an GPIO Zero Output device
View relay-test.py
#!/usr/bin/python
# A simple Python application for controlling a relay board from a Raspberry Pi
# The application uses the GPIO Zero library (https://gpiozero.readthedocs.io/en/stable/)
# The relay is connected to one of the Pi's GPIO ports, then is defined as an Output device
# in GPIO Zero: https://gpiozero.readthedocs.io/en/stable/api_output.html#outputdevice
import sys
import time