You can change lines 9 and 16 like this 9 REPEAT 'The code between 9 and 16, will be repeated 'Until you press a button 16 UNTIL BUTTON() 21 WAIT 300 '