Page 196 - CodePilot V5.0 C8
P. 196

The explanation of the code is as follows:
                      The program starts when the when started block is triggered.

                      The robot’s drive and turn velocity is set to 100% for full speed.
                      A while loop runs until the Down Eye sensor detects red beneath the robot and checks the distance:

                     •  If the distance is greater than 200 mm, it drives 250 mm forward, then turns right by 90°.
                     •  If the distance is less than 200 mm, it turns left by 90° to find a clear path.

                      Once red is detected, the loop ends and the robot stops.

                   RAPID RECALL                             Tick ( ) if you know this.


                      1.  Control blocks let you decide when and how often the robot acts.

                      2.  Distance sensing blocks use the robot’s distance sensor to measure the space
                          between the  robot and obstacles.




                                                                                             21 st   #Critical Thinking
                       EXPERIENTIAL LEARNING                                                Century   #Technology Literacy
                                                                                             Skills
                    Draw geometric shapes like squares, triangles and hexagon using Drawing blocks.





                         USING MAGNET BLOCKS


                  Magnet  blocks allow the  virtual robot  to  pick  up  and drop  magnetic  disks  using  its  built-in
                  electromagnet. These blocks are essential for simulations where the robot interacts with objects
                  like coloured disks.


                                                      energize Magnet   to  boost



                  The Magnet Block in VEXcode VR has two settings:
                      Boost: This increases the magnet’s strength so the robot can pick up multiple disks at once. It
                     is useful when you need to collect a group of disks quickly.

                      Drop: This lowers the strength of the magnet so it can release the disks it is carrying. The robot
                     drops them at the desired location (like a goal zone).

                    Program 7 Prepare a disk mover program.


                  The  robot’s  task  is to  locate,  pick  up and sort coloured  disks  on the Disk Mover playground.
                  Using its electromagnet and sensor logic, it must identify each disk’s colour and transport it to

                  the corresponding drop zone.





                   194
                        CodePilot (V5.0)-VIII
   191   192   193   194   195   196   197   198   199   200   201