I now want to be able to start my loop to run once with the press of a push button and then when finnished await the next push of the button.
If you only run it once maybe it's not a loop.
If you're only doing it once, it can be a regular if-statement. If you're doing a bunch of stuff when you press a button and bunch of other stuff when you press a different button, you might want to write a [u]function[/u] and then call the function when the button is pushed.
However, you do need to loop while you're waiting for a button-push.... Depending on your program, that might be your main loop...
A "do nothing" while() loop is an easy way to wait for a button push
while (ButtonState == 0)
{
// Run this do-nothing loop until the button is pressed
}
The downside of that is you're "stuck in a loop" doing nothing until the button is pushed, so you have to make sure that's OK in your application.
I also want to be able to (in the future) add in other loops in the program linked to other buttons so I can in effect choose which loop to run by what button I press.
You can use multiple if-statements, or possibly [u]switch-case[/u]. It's very common to call a different function for each "case".
...but not 100% on howto implement it.
You do have to think-about your overall program structure,