Your code is not very well formatted. You should use Ctrl-T to autoformat your code
instead of hardcoded numbers for IO-pins you should use meaningful names for the io-pins and everything else.
Using meaningful names for everything makes code much easier to understand and to maintain.
So which of the existing RemoteXY-buttons shall be used for the pause/resuming function?
Does the above posted code contain that button?
If yes which button is it?
If the code does not contain this button you should at least provide a code-version where the button is defined.
You seem to create the stepper-motor-pulses with these lines of code
if (RemoteXY.button_r == 1) {
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
delay(10);
digitalWrite(9, LOW);
delay(10);
stepNo++;
}
else if (RemoteXY.button_l == 1) {
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
delay(10);
digitalWrite(9, LOW);
delay(10);
stepNo--;
}
I can only assume it because the IO-numbers "8", "9", say nothing about their purpose
You should use a stepper-motor-library.
I recommend that you use the MObaTools-library because this library creates the step-pulses automatically. You can start and stop the stepper-motor at any time and the MobaTools-library counts the steps for you automtically.
Last but not least whih exact type of microcontroller are you using?
So we need additional information from you for decent support