Files
micropython-testing/motor.py
2026-04-14 21:31:59 +02:00

28 lines
493 B
Python

from time import sleep
from machine import Pin
from drv8825 import DRV8825
def motor_run():
motor = DRV8825(
Pin(21, Pin.OUT), Pin(19, Pin.OUT), Pin(18, Pin.OUT), Pin(5, Pin.OUT)
)
motor.init()
while True:
motor.set_direction(DRV8825.LEFT)
for i in range(0, 1000):
motor.make_step(2000)
sleep(1)
motor.set_direction(DRV8825.RIGHT)
for i in range(0, 1000):
motor.make_step(2000)
sleep(1)