Use an interrupt. Or inside of every loop have a GOSUB to check the button.