Hi!
I am trying to do a project - it's actually part of my thesis on the university.
The basics:
-
I'd like to control two stepper motors (I have two Nema23s).
-
Each of them move an installment in one direction forwards and backwards. - Basically a special XY-table.
-
The motors have to move the table in a special motion.
-
Go along one axis with little pauses in between,
-
one step along the secondary axis,
-
then come back along the primary axis.
-
One step along the secondary axis again, the same direction as before, etc.
-
You get the idea, I hope. Like a sweep.
-
The sweep has pauses, which are for ultrasonic measurements to be done (that's why I have the time intervals set up at the beginning of th ecode) - not part of my thesis.
-
After completing the sweep, the table needs to return to its original position.
I need to run this only once per power cycle - as I don't need the installment to run around like a maniac - so I put my code in the setup() section.
For the buttons: I'd like to use three buttons, functions below:
- One to move the installment - as long as pressed - along the primary axis (opposite direction) to setup a starting position along the primary axis.
- One to move the installment along the secondary axis. Goal: same as the one above.
- One to start the sweep (described above).
I am getting a bit confused how to do this, because every example I read about buttons and their usage used the buttons in the loop() section as their status needs to be checked repeatedly.
How can I get a basic loop for checking the buttons' status inside the setup() phase?
Project code in attached .txt file.
(The code would be too long to post here in "code" . Will try writing a procedure for movement to call in the setup() - e.g.: moveX(), moveY(), etc.)
Forgive me if any of the lines are not understandable, I had to translate the comments from Hungarian to English.
Thanks a lot for all the help in advance!
Cheers,
MacTavish
XY-axis.txt (4.79 KB)