Start/stop loop via button, noob halp!

it now won't stop the loop

To figure out why, print out values of run at various places in the program.
Edit:
But here is a hint: what is the very first thing that happens after the "if" statement detects that the button is pressed?

Did you post the latest version of your program in reply #5?

If statement format is still wrong in the following:

    if (run = 1)