feat: stepper logic

This commit is contained in:
xGlc
2026-04-14 21:31:59 +02:00
parent 07d93402b3
commit f94073e1ea
3 changed files with 73 additions and 2 deletions

27
motor.py Normal file
View File

@@ -0,0 +1,27 @@
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)