from machine import Pin
import time
#botones
interuptor1 = Pin(16,Pin.IN, Pin.PULL_UP)
interuptor2 = Pin(22,Pin.IN, Pin.PULL_UP)
interuptor3 = Pin(14,Pin.IN, Pin.PULL_UP)
#7 segmentos
a = Pin(27, Pin.OUT)
b = Pin(26, Pin.OUT)
c = Pin(25, Pin.OUT)
d = Pin(13, Pin.OUT)
e = Pin(17, Pin.OUT)
f = Pin(4, Pin.OUT)
g = Pin(2, Pin.OUT)
#def segmentos (A,B,C,D,E,F,G):
while True:
medida1 = not interuptor1.value()
#print("boton rojos",medida1)
medida2 = not interuptor2.value()
#print("boton ama",medida2)
medida3 = not interuptor3.value()
#print("boton ver", medida3)
#time.sleep(0.8)
if medida1 == True:
a.value(1)
b.value(1)
c.value(1)
d.value(0)
e.value(1)
f.value(1)
g.value(1)
print("nivel de agua critico")
time.sleep(0.8)
elif medida2 == True:
a.value(1)
b.value(0)
c.value(0)
d.value(1)
e.value(1)
f.value(1)
g.value(0)
#segmentos(1,0,0,1,1,1,0)
print("nivel de agua medio")
time.sleep(0.8)
elif medida3 == True:
a.value(1)
b.value(0)
c.value(0)
d.value(0)
e.value(1)
f.value(1)
g.value(1)
#segmentos(1,0,0,0,1,1,1)
print("nivel de agua alto")
time.sleep(0.8)