feat: stepper logic
This commit is contained in:
27
motor.py
Normal file
27
motor.py
Normal 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)
|
||||
Reference in New Issue
Block a user