-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLed_Array.py
49 lines (40 loc) · 1.34 KB
/
Led_Array.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
49
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
pinList=[26,19,13,6,5,21,20,16]
for i in pinList:
GPIO.setup(i,GPIO.OUT)
def oneByOne(rpt,delay):
for j in range(0,rpt):
for i in pinList:
GPIO.output(i,GPIO.HIGH)
print(" Led "+str(i)+" on")
time.sleep(delay)
GPIO.output(i,GPIO.LOW)
print(" Led "+str(i)+" off")
print("Quit")
#oneByOne(int(rep),float(delay))
def allOnOneByOne(rpt,delay):
for j in range(0,rpt):
for i in pinList:
GPIO.output(i,GPIO.HIGH)
print(" Led "+str(i)+" on")
time.sleep(delay)
for i in pinList:
GPIO.output(i,GPIO.LOW)
print(" Led "+str(i)+" off")
time.sleep(delay)
print("Quit")
#allOnOneByOne(int(rep),float(delay))
def mainfun():
men=raw_input("Menu: Please Enter Your Choice \n 1. for One By One Scan \n 2. For On All Onec Then Off \n ")
if(int(men)==1):
rep=raw_input("Enter No Of Repetation= ")
delay=raw_input("Enter delay In Sec= ")
oneByOne(int(rep),float(delay))
else:
rep=raw_input("Enter No Of Repetation= ")
delay=raw_input("Enter delay In Sec= ")
allOnOneByOne(int(rep),float(delay))
GPIO.cleanup()
mainfun()