-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuProg05.py
More file actions
77 lines (66 loc) · 1.64 KB
/
uProg05.py
File metadata and controls
77 lines (66 loc) · 1.64 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
72
73
74
75
76
77
#programa #5a--------Timer mejorado
from machine import Pin
from time import sleep_ms
#Entradas
a = Pin(16, Pin.IN,pull=Pin.PULL_UP) #botones
b = Pin(17, Pin.IN,pull=Pin.PULL_UP)
#Salidas
led1 = Pin(12,Pin.OUT,value=1) #indicar que el sistema esta encendido
led2 = Pin(13,Pin.OUT,value=0)
led3 = Pin(14,Pin.OUT,value=0)
on_off = Pin(15,Pin.OUT,value=0)
Edo = 0
t = 3
while True:
sel = a.value() #se guarda el valor de a
timer = b.value() #si se presiona se guardan
if (Edo==0) and (sel==0): #estado 1 y tiempo igual a 6
led1.on() #secuencia de las luces
led2.on()
led3.off()
t = 6
Edo = 1
sel = 1
sleep_ms(250)
if (Edo==1) and (sel==0):
led1.off() #secuencia de las luces
led2.on()
led3.off()
t = 9
Edo = 2
sel = 1
sleep_ms(250)
if (Edo==2) and (sel==0):
led1.off() #secuencia de las luces
led2.on()
led3.on()
t = 12
Edo = 3
sel = 1
sleep_ms(250)
if (Edo==3) and (sel==0):
led1.off() #secuencia de las luces
led2.off()
led3.on()
t = 15
Edo = 4
sel = 1
sleep_ms(250)
if (Edo==4) and (sel==0):
led1.on() #secuencia de las luces
led2.off()
led3.off()
t = 3
Edo = 0
sel = 1
sleep_ms(250)
if (timer==0):
on_off.on()
sleep_ms(t*1000) #convertirlo a segundos
on_off.off()
#Devolvera el estado 0
led1.on()
led2.off()
led3.off()
t = 3
Edo = 0