-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathoutput_test.py
More file actions
42 lines (28 loc) · 835 Bytes
/
output_test.py
File metadata and controls
42 lines (28 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
!!!! THIS PROGRAM COULD DAMAGE YOUR PI IF GPIO IS NOT CORRECTLY CONNECTED
To Run - sudo python output_test.py from a terminal window
All outputs that can be used by Pi Presents will change state every 5 seconds
A log will be written to the terminal window.
To exit type CTRL-C
"""
import RPi.GPIO as GPIO
from time import sleep
def write_pins(value):
for pin in pins:
print 'Pin ',pin,value
GPIO.output(pin,value)
ON_VALUE= GPIO.HIGH
OFF_VALUE=GPIO.LOW
pins=[3,5,7,8,10,11,12,13,15,16,18,19, 21, 22, 23, 24, 26]
GPIO.setwarnings(False)
GPIO.cleanup()
GPIO.setmode(GPIO.BOARD)
for pin in pins:
GPIO.setup(pin,GPIO.OUT)
while True:
print '\n***** ON ******'
write_pins(ON_VALUE)
sleep (5)
print '\n***** OFF *****'
write_pins(OFF_VALUE)
sleep(5)