Permalink
Browse files

Added relay code

  • Loading branch information...
1 parent 0e5b0dc commit 28a6b14913ff4a01c8e650a708e3a616b367243e @videoman committed Feb 5, 2013
Showing with 73 additions and 0 deletions.
  1. +21 −0 Relay_Fun1.py
  2. +26 −0 Relay_Fun2.py
  3. +26 −0 Relay_Fun3.py
View
@@ -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)
View
@@ -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)
+
View
@@ -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.