
Kildekode til robot
Fork of Team5 by
Diff: robot.cpp
- Revision:
- 8:5ca76759a67e
- Parent:
- 7:a852e63cac3d
diff -r a852e63cac3d -r 5ca76759a67e robot.cpp --- a/robot.cpp Fri Dec 09 12:32:21 2016 +0000 +++ b/robot.cpp Mon Dec 12 13:35:34 2016 +0000 @@ -21,36 +21,20 @@ ///////////////////////////////////////////////////////////////////////////// // Driving setup // ///////////////////////////////////////////////////////////////////////////// - while(1) //Remember to include if statement to stop robot if it's time to recharge - { - read_analog(); - startfunction(); - get_to_goal(); - robot.stop(); - printf("\n\r DistanceBysensor: %.2f \n", Dcenter()); - wait_ms(2000); - - read_analog(); - startfunction(); - get_to_goal(); - robot.stop(); - printf("\n\r DistanceBysensor: %.2f \n", Dcenter()); - wait_ms(2000); - - read_analog(); - startfunction(); - get_to_goal(); - robot.stop(); - printf("\n\r DistanceBysensor: %.2f \n", Dcenter()); - wait_ms(2000); - - read_analog(); - startfunction(); - get_to_goal(); - robot.stop(); - printf("\n\r DistanceBysensor: %.2f \n", Dcenter()); - wait_ms(2000); - } + + while(1) + { + startfunction(); + get_to_goal(); + robot.stop(); + printf("\n\r DistanceBysensor: %.2f \n", Dcenter()); + wait_ms(2000); + + init(); + startfunction(); + turn(); + robot.stop(); + } } /* ----------------------------------------------------------------------------