This a companion video to "Arduino Programming Tutorials || How to Construct TimeSensitive While Loops".
• Arduino Programming Tutorials || How ... o
If you haven't already viewed that video, then I'd encourage you to do so before or after viewing this one.
This video includes examples of how 'timesensitive' while loops can be used to control steppers motors (1) independently, (2) in a pseudo simultaneous manner, and in a more (3) standard linear actuation scenario. Such loops can be used in cases where one knows how long he/she wants a stepper to step but not necessarily the exact number of steps. It can also be used in many applications beside stepper motor control e.g., collecting sensor data for specific intervals, blinking lights for specific intervals, etc., etc. It's certainly not a one size fits all situations sort of code structure but I have found it to be useful in a significant number of cases.
For more precision and error checking/correcting capabilities (in the linear actuation case) one will likely need to stick with the standard stepcounting procedure and limit detecting switches/sensors. But if/when "perfect" precision isn't necessarily needed (like in cases of constructing a small hobbystyle robot, etc,), then time sensitive while loops are a potentially helpful structure to try out.
Primary Parts:
(2) 12V NEMA 17 Stepper Motors (200 step)
(2) NEMA 17 motor mounts
Adafruit Motor Shield V2
Arduino Uno
5mm Actobotics screw hubs
(2) wheels from Sparkfun
The code associated with the examples in this video can be found in the first comment. Note that it uses libraries associated with version 2 of the Adafruit Motor Shield. But, the code logic should be very close if not entirely the same for applications using other shields and/or stepper motor interface circuitry.
Hope the examples are helpful. Please let me know if there are any questions in the comments.
And, if this video was helpful, then please consider clicking like and subscribing to my channel. Thanks for watching.