Hey guys so I have been working on code to run a camera slider with a pan and tilt head (3 stepper motors) and I am so close to finishing it but I can’t seem to get a piece of the code to work when summoned by a button press. It works perfectly if I just place it in the loop but doesn’t when summoned by the button. When the code is working correctly it moves the motor 500 steps then pauses and outputs to the shutterPIN then moves again and this is repeated the photo int number of times which is currently set to 10. When this code gets summoned by the button it moves the motor once and then outputs to the shutterPIN but does not repeat this the designed number of times which is 10. The code is bellow, any suggestions?
I have included both the code where the [playTimeLapse()] doesn’t work when summoned by the button as well as the code where the [playTimeLapse()] works when in the void loop alone so that you can see how the [playTimeLapse()] is suppose to work. They are attachments otherwise it was too long.
Thanks in advance
Code_where_the_small_piece__playTimeLapse____doesn_t_work_when_.ino (9.06 KB)
Code_where_the_small_piece__playTimeLapse____works_in_void_loop.ino (9.05 KB)