int automode=0; if(p1_trig==1)autmode=1; while(automode==1) { if(p1_trig==1)autmode=0; User_Autonomous_Code(); }