Page 188 - CodePilot V5.0 C8
P. 188

Now,  observe how  the robot  behaves in the
                  playground.




                                 SHORT SIGN


                               To open playground:
                                      Ctrl + I







                    Program 1    Move the robot on the Grid Map playground in zig-zag pattern.

                  The task is to make the robot move in a zig-zag pattern. This is achieved by having the robot
                  move forward and then alternate between turning right and left at a specific angle, creating a
                  back-and-forth movement.

                  The code and output of the given task are as follows:


                   when started

                   turn  right  for  60  degrees

                   drive  forward  for  200  mm
                   turn  left  for  60  degrees

                   drive  forward  for  200  mm

                   turn  right  for  60  degrees
                   drive  forward  for  200  mm

                   turn  left  for  60  degrees

                   drive  forward  for  200  mm
                   turn  right  for  60  degrees

                   drive  forward  for  200  mm

                   turn  left  for  60  degrees
                   drive  forward  for  200  mm

                   turn  right  for  60  degrees

                   drive  forward  for  200  mm
                   turn  left  for  60  degrees

                   drive  forward  for  200  mm


                  The robot will move along the dotted path that is not visible on the playground window.



                   186
                        CodePilot (V5.0)-VIII
   183   184   185   186   187   188   189   190   191   192   193