adafruit / Adafruit_CircuitPython_MotorKit

CircuitPython helper library for the DC & Stepper Motor FeatherWing, Shield and Pi Hat kits.
MIT License
86 stars 31 forks source link

Update motorkit_stepper_simpletest.py #19

Closed ladyada closed 4 years ago

ladyada commented 5 years ago

add delay

caternuson commented 5 years ago

I think examples/motorkit_stepper_test.py also needs this patch? It has the same loops.

How about making the delay a const like thing? That way it can be tweaked as needed easily. Esp. since there are multiple loops in examples/motorkit_stepper_test.py.

STEP_DELAY = 0.01

for i in range(100):
    kit.stepper1.onestep()
    time.sleep(STEP_DELAY)
ladyada commented 5 years ago

yeah i didnt get to work on the test/code this weekend, but all the examples that have a stepper should have a STEP_DELAY!

caternuson commented 5 years ago

Oh yeah, there's also examples/motorkit_dual_stepper_test.py which is multi-threaded. I think time.sleep() is OK there? It blocks thread, not process.

ladyada commented 5 years ago

yeah i think its fine to have there too, that one is mimic'd from the original Python library

caternuson commented 5 years ago

Hmm. Maybe time.sleep is too crude? https://forums.adafruit.com/viewtopic.php?f=31&t=154221&start=15#p762855

ladyada commented 5 years ago

we used sleep in the previous library https://github.com/adafruit/Adafruit-Motor-HAT-Python-Library/blob/master/Adafruit_MotorHAT/Adafruit_MotorHAT_Motors.py#L159

caternuson commented 4 years ago

Just trying to make sure / remember - this PR was for #18, right?

ladyada commented 4 years ago

yah i htink so!

dhalbert commented 4 years ago

@caternuson This has been hanging for a while. Any reason not to approve this?

caternuson commented 4 years ago

@dhalbert not that i can remember. if there is anything, can just reopen.