from machine import Pin
import time
STEP = Pin(19, Pin.OUT)
DIR = Pin(18, Pin.OUT)
EN = Pin(26, Pin.OUT)
# Habilitar el controlador A4988
EN.value(0)
while True:
# Giro en un sentido
DIR.value(1)
for i in range(200):
STEP.value(1)
time.sleep_us(500)
STEP.value(0)
time.sleep_us(500)
time.sleep(1)
# Giro en sentido contrario
DIR.value(0)
for i in range(200):
STEP.value(1)
time.sleep_us(500)
STEP.value(0)
time.sleep_us(500)
time.sleep(1)
Loading
esp32-devkit-c-v4
esp32-devkit-c-v4