Pages: [1]   Go Down
Author Topic: Stepper library changes  (Read 973 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
God Member
*****
Karma: 1
Posts: 547
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

While building the controls for my Harbor Freight micromill I became aware that the step method was non blocking in the sense that the call returned whether or not an actual step took place. I modified the library to return a boolean state, true if the motor stepped and false if it didn't. It would be rare to have a stepper take off and step 'n' steps without coordinating those steps with other steppers in the same system.

* Stepper.zip (7.55 KB - downloaded 5 times.)
Logged

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 221
Posts: 13851
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


How would someone use this boolean state in a real sketch?

Must I call step again to get the step done?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
God Member
*****
Karma: 1
Posts: 547
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No, the boolean return value has no effect on the function of the stepper object, but is a means to inform the caller as to whether the step request succeeded or not. I used the boolean to have my code continue to call step until it actually stepped as I am using accumulators for coordinates as I do not have a DRO on the machine.
Logged

Pages: [1]   Go Up
Jump to: