Created
June 18, 2015 15:56
-
-
Save sukso96100/77c4320ab360268c5139 to your computer and use it in GitHub Desktop.
Raspberry Pi Model B+ 8 Channel Relay Module Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO | |
import time | |
print "Ready?" | |
time.sleep(5) | |
print "Setting GPIO Mode as BCM" | |
GPIO.setmode(GPIO.BCM) | |
print "Setting Up GPIO from 2 to 9" | |
GPIO.setup(2, GPIO.OUT) | |
GPIO.setup(3, GPIO.OUT) | |
GPIO.setup(4, GPIO.OUT) | |
GPIO.setup(5, GPIO.OUT) | |
GPIO.setup(6, GPIO.OUT) | |
GPIO.setup(7, GPIO.OUT) | |
GPIO.setup(8, GPIO.OUT) | |
GPIO.setup(9, GPIO.OUT) | |
print "Testing Relay Module Control with GPIO" | |
for i in range(2, 10): | |
GPIO.output(i,True) | |
time.sleep(1) | |
print("GPIO %d is True" % (i)) | |
for i in range(2, 10): | |
GPIO.output(i,False) | |
time.sleep(1) | |
print("GPIO %d is False" % (i)) | |
print "Done Testing. Cleaning Up GPIO" | |
GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment