Bleedscarlet, thanks a lot for taking a look. I really appreciate you taking the time to think about this a little but. I think maybe my original post was too lengthy, which lead to a bit of skimming-over, so I'll try to clarify a couple of things.
How powerful is the servo, I assume not very?
Try the motor shield, it makes simple work of controlling a servo. It might cost a couple bucks but it's nothing too significant.
I'll be using steppers not servos (which I think you realize, maybe you mistyped
), and I'll be using 3 of them, which is one more than the motorshield can accommodate. I will be using EasyDriver boards to drive the steppers. From the bit I've played aruond with them already, they seem easy to control, so I'm not too worried about the coding for that part of the project.
I believe you are on to something with the bit of code you've suggested. I'm hoping you can clarify something for me though. Do you think the first IF statement should be made into a While statement in order to make the stepper continue to move forward until the requirement is met? Looking at your code, my uneducated and untrained eye (read: I could be very wrong about this) makes me think that the code as you've written it will only make the stepper act once, rather than continuing to step until SensePin==LOW. Here is what I'm thinking of doing...
// a position determined elseware in the program
// after the stepper has landed at a desired location...
// the location is saved here to compare new settings to
// SetHands is a function called...
// from another place in the program
if (Position != OldPosition)
if (digitalRead (SensePin)==HIGH)
//stepper is already at zero position
//MoveHand function makes stepper move X steps
//causes stepper to rotate until zero position is reached
x = 1;
y = 0;
//SensePin LOW = sensor not tripped
move forward 1 step;
//move stepper x steps
Position = OldPosition;
I'm not even sure I can put two functions in that else statement (calibrate() movehands()
), I may have to move that movehands() to the 'else if' statement of the calibrate() function, before the x=y. Anyway, please let me know what you think. And if anyone else is checking this out, please feel free to jump in. The more the merrier, and hopefully I'll learn something