Handling limit switches?

mardi 3 février 2015

I'm trying to build a basic camera slider, didn't have much success with an earlier post.



I have all the hardware sorted, and 99% of the code for controlling an Arduino UNO. The sketch for the Arduino was written by Brian Schmalz, basically consisting of a left push button, a stop push button, a right push button and a speed control pot.



The basic hardware consists of an aluminium track, a carriage, a nema17 stepper motor at one end and a return pulley at the other for the toothed belt.



So far so good, where I'm struggling is code for limit switches at each end. The problem is once the limit switch is depressed and kept depressed, no other action can take place.



What I'm trying to achieve is this. Once a limit switch is hit, tell the Arduino to stop the motor with no further movement in that direction, but allow motion in the opposite direction to take place when the appropriate pb is pressed.



Brian's sketch is here, it's the last example using an Adafruit motor shield V2.



http://ift.tt/1K70yKw



One of my thoughts was that as soon as the limit switch is hit, the motor stops and backs off the switch, allowing the reverse button to be pressed. I don't reckon this is the answer, and in fact I wouldn't know how to code that anyway.



I'm hoping for some assistance, you blokes are supposed to be smart, meow.



Ken




0 commentaires:

Enregistrer un commentaire

 

Lorem

Ipsum

Dolor