from machine import ADC, Pin
from time import sleep
DIR = Pin(12, Pin.OUT)
Step = Pin(13, Pin.OUT)
Boton = Pin(15, Pin.IN)
led= Pin(2, Pin.OUT)
def DIR_HORARIO():
DIR.on()
Step.on()
sleep(0.00125)
Step.off()
def DIR_ANTIH():
DIR.off()
Step.on()
sleep(0.00125)
Step.off()
while True:
Count = 0 # Reiniciar el contador en 0
if(Boton.value() == 1):
print("Reinicio de Motor, Pasos: 0")
led.on()
sleep(0.1)
for i in range(0):
DIR_ANTIH()
sleep(0.001)
else:
led.off()
for i in range(4000):
DIR_HORARIO()
sleep(0.001)
Count += 1
print("Motor activado, Pasos:",Count)
if (Boton.value() == 1):
break