This repository was archived by the owner on Dec 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLed.py
More file actions
72 lines (47 loc) · 1.36 KB
/
Led.py
File metadata and controls
72 lines (47 loc) · 1.36 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import RPi.GPIO as GPIO
import time
def setup():
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(26,GPIO.OUT) #LED DE ESTADO 'QR'
GPIO.setup(25,GPIO.OUT) #LED DE ESTADO 'SCANNING'
GPIO.setup(6,GPIO.OUT) #LED DEL BOTON
def ledOn(led):
if(led == 1):
GPIO.output(26,GPIO.HIGH)
print ("LED 1 ON")
elif(led == 2):
GPIO.output(25,GPIO.HIGH)
print ("LED 2 ON")
else:
GPIO.output(6,GPIO.HIGH)
print ("LED 3 ON")
def ledOff(led):
if(led == 1):
GPIO.output(26,GPIO.LOW)
print ("LED 1 OFF")
elif(led == 2):
GPIO.output(25,GPIO.LOW)
print ("LED 2 OFF")
else:
GPIO.output(6,GPIO.LOW)
print ("LED 3 OFF")
def ledError():
counter = 0
while(counter < 10):
GPIO.output(26,GPIO.HIGH)
print ("LED 1 ON")
GPIO.output(25,GPIO.HIGH)
print ("LED 2 ON")
GPIO.output(6,GPIO.HIGH)
print ("LED 3 ON")
time.sleep(0.1)
GPIO.output(26,GPIO.LOW)
print ("LED 1 OFF")
GPIO.output(25,GPIO.LOW)
print ("LED 2 OFF")
GPIO.output(6,GPIO.LOW)
print ("LED 3 OFF")
time.sleep(0.1)
print ("counter:", counter)
counter = counter + 1