Skip to content

Instantly share code, notes, and snippets.

@Edocsyl
Last active December 21, 2015 16:28
Show Gist options
  • Save Edocsyl/6333349 to your computer and use it in GitHub Desktop.
Save Edocsyl/6333349 to your computer and use it in GitHub Desktop.
Raspberry PI Rev 1 & 8 Channel Relay module; This script goes through every defined gpio port and powers every relay for 0.5 sec.
#!/usr/bin/env python
import RPi.GPIO as GPIO, time as t
#Define GPIO Ports http://bit.ly/14RmXp2
r = [8, 10, 12, 16, 18, 22, 24, 26]
#Setup GPIO
GPIO.setwarnings(False)
GPIO.cleanup()
GPIO.setmode(GPIO.BOARD)
#Go through every port
for i in r:
GPIO.setup(i, GPIO.OUT)
GPIO.output(i, False)
t.sleep(0.5)
GPIO.output(i, True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment