from machine import Pin, PWM
import time
# Configuration des broches
step_pin = Pin(14, Pin.OUT) # Broche STEP du contrôleur A4988
dir_pin = Pin(12, Pin.OUT) # Broche DIR du contrôleur A4988
ms_2 = Pin(5, Pin.OUT) # Broche ENABLE du contrôleur A4988
#display : angle
def move_stepper(direct,steps, delay, ms2_valeur, accel):
dir_pin.value(direct)
#ms_2.value(1)
ms_2.value(ms2_valeur)
#steps = abs(steps)
for i in range(steps):
step_pin.value(1)
time.sleep_us(delay)
step_pin.value(0)
time.sleep_us(delay)
def stop_stepper():
step_pin.value(0)
while True:
move_stepper(0,100,2000,1,5)
time.sleep(2)
move_stepper(1,200,2000,1,5)
time.sleep(2)
move_stepper(0,100,2000,1,5)
time.sleep(2)
stop_stepper(1)