xeforux
Newbie level 2
hi, im doing a program to move a robot from (x1,y1) to (x2,y2). the problem is the robot did not update its current location after moved to the next location. here the code:
the problem is the program immediately jump to "goal found"
kindly help ;-)
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 if(S1==0) { LED1=1; robot_x=3; robot_y=1; goal_x=3; goal_y=3; new_state=2; while(robot_y!=goal_y && robot_x!=goal_x) { scanningR(); //check for obstacle on right scanningL(); //left scanningC(); //front if(new_state==1) check_vertical1(robot_x,robot_y,goal_x,goal_y); else if(new_state==2) check_horizontal2(robot_x,robot_y,goal_x,goal_y); else if(new_state==3) check_vertical3(robot_x,robot_y,goal_x,goal_y); else if(new_state==4) check_horizontal4(robot_x,robot_y,goal_x,goal_y); } stop(); Lcd_Out(1,1," GOAL "); Lcd_Out(2,1," FOUND "); }
the problem is the program immediately jump to "goal found"
kindly help ;-)
Last edited by a moderator: