-
Notifications
You must be signed in to change notification settings - Fork 231
Closed
Description
commit e4d5059
could you please post some lua code demonstrating how these functions work?
- I was unable to start stepper motors with the stepper.startasync () command.
- the stepper.stopasync () command stops all motors.
my code:
m1.stepper = stepper.attach(m1.dir_pin, m1.step_pin, 200, 60, 6000, 100, 100)
m2.stepper = stepper.attach(m2.dir_pin, m2.step_pin, 200, 60, 6000, 100, 100)
function run(motor)
function _run()
pio.pin.setlow(motor.en_pin)
stepper.start(motor.stepper)
-- stepper.startasync(motor.stepper) -- does not work
end
if motor.stepper:getdistance() ~= 0 then
th = thread.start(_run)
end
end
m1.stepper:move(1000)
m2.stepper:move(1000)
run(m1)
run(m2)
tmr.sleepms(1000)
stepper.stopasync(m1.stepper) -- all steppers stopped
Metadata
Metadata
Assignees
Labels
No labels