-
Notifications
You must be signed in to change notification settings - Fork 218
/
script5.py
executable file
·48 lines (32 loc) · 895 Bytes
/
script5.py
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
40
41
42
43
44
45
46
47
48
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
# init list with pin numbers
pinList = [2, 3, 4, 17, 27, 22, 10, 9]
# loop through pins and set mode and state to 'low'
for i in pinList:
GPIO.setup(i, GPIO.OUT)
GPIO.output(i, GPIO.HIGH)
# time to sleep between operations in the main loop
SleepTimeS = 0.2
SleepTimeL = 0.5
# main loop
try:
while True:
for i in pinList:
GPIO.output(i, GPIO.LOW)
time.sleep(SleepTimeS);
GPIO.output(i, GPIO.HIGH)
time.sleep(SleepTimeS);
GPIO.output(i, GPIO.LOW)
time.sleep(SleepTimeS);
GPIO.output(i, GPIO.HIGH)
time.sleep(SleepTimeL);
# End program cleanly with keyboard
except KeyboardInterrupt:
print (" Quit")
# Reset GPIO settings
GPIO.cleanup()
# find more information on this script at
# http://youtu.be/oaf_zQcrg7g