forked from shrocky2/SiriGarage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelaytest.py
More file actions
19 lines (15 loc) · 689 Bytes
/
Copy pathrelaytest.py
File metadata and controls
19 lines (15 loc) · 689 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
print(" Control + C to exit Program")
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD) # the pin numbers refer to the board connector not the chip
GPIO.setwarnings(False)
GPIO.setup(7, GPIO.OUT) # sets the pin input/output setting to OUT
GPIO.output(7, GPIO.HIGH) # sets the pin output to high
try:
while 1 >=0:
GPIO.output(7, GPIO.LOW) # turns the first relay switch ON
time.sleep(.5) # pauses system for 1/2 second
GPIO.output(7, GPIO.HIGH) # turns the first relay switch OFF
time.sleep(.5)
except KeyboardInterrupt: # Stops program when "Control + C" is entered
GPIO.cleanup() # Turns OFF all relay switches