Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added relay code
  • Loading branch information
videoman committed Feb 5, 2013
1 parent 0e5b0dc commit 28a6b14
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Relay_Fun1.py
@@ -0,0 +1,21 @@
#!/usr/bin/python
#
# Hack Factory Raspberry Pi Class.
# David M. N. Bryan, dave@drstrangelove.net
#

# import the Raspberry Pi GPIO Library
import RPi.GPIO as GPIO

# Define OUTPUT Pins on RPI
RELAY1_PIN=25
RELAY2_PIN=24

# Set the pins to OUTPUTS
GPIO.setmode(GPIO.BCM)
GPIO.setup(RELAY1_PIN, GPIO.OUT)
GPIO.setup(RELAY2_PIN, GPIO.OUT)

while True:
GPIO.output(RELAY1_PIN, False)
GPIO.output(RELAY2_PIN, False)
26 changes: 26 additions & 0 deletions Relay_Fun2.py
@@ -0,0 +1,26 @@
#!/usr/bin/python
#
# Hack Factory Raspberry Pi Class.
# David M. N. Bryan, dave@drstrangelove.net
#

# import the Raspberry Pi GPIO Library
import RPi.GPIO as GPIO, time, os

# Define OUTPUT Pins on RPI
RELAY1_PIN=25
RELAY2_PIN=24

# Set the pins to OUTPUTS
GPIO.setmode(GPIO.BCM)
GPIO.setup(RELAY1_PIN, GPIO.OUT)
GPIO.setup(RELAY2_PIN, GPIO.OUT)

while True:
GPIO.output(RELAY1_PIN, False)
GPIO.output(RELAY2_PIN, False)
time.sleep(.25)
GPIO.output(RELAY1_PIN, True)
GPIO.output(RELAY2_PIN, True)
time.sleep(.25)

26 changes: 26 additions & 0 deletions Relay_Fun3.py
@@ -0,0 +1,26 @@
#!/usr/bin/python
#
# Hack Factory Raspberry Pi Class.
# David M. N. Bryan, dave@drstrangelove.net
#

# import the Raspberry Pi GPIO Library
import RPi.GPIO as GPIO, time, os

# Define OUTPUT Pins on RPI
RELAY1_PIN=25
RELAY2_PIN=24

# Set the pins to OUTPUTS
GPIO.setmode(GPIO.BCM)
GPIO.setup(RELAY1_PIN, GPIO.OUT)
GPIO.setup(RELAY2_PIN, GPIO.OUT)

while True:
GPIO.output(RELAY1_PIN, False)
GPIO.output(RELAY2_PIN, True)
time.sleep(.25)
GPIO.output(RELAY1_PIN, True)
GPIO.output(RELAY2_PIN, False)
time.sleep(.25)

0 comments on commit 28a6b14

Please sign in to comment.