Page 93 - Ai Robogenius
P. 93

Logic–Variables

                 Variable blocks are used to store values like counts, scores or distances and track changes in a
                 project. They help control the robot’s behaviour based on these values. You can create a new
                 variable with the Make a Variable button, which acts as a container for storing and updating
                 values like numbers or text.
                 Some of the important Variables blocks are as follows:

                                Block                                          Description
                                                       This block  refers to  a custom  variable  that  you  create  in
                   myVariable
                                                       your project.


                   set  myVariable  to  1              This block assigns a value to the variable.


                                                       This block  increases  or decreases  (if you  use  a  negative
                    change  myVariable  by  1
                                                       number) the value of the variable by a specified amount.

                 Logic–Comments

                 Comment blocks are used to add notes or explanations within the code. These notes
                 are not executed by the program but help programmers understand the purpose of             comment
                 different parts of the code, making it easier to read and maintain.

                        VISUAL VAULT
                        Identify and explain the blocks given below:


                        1.     FrontEye   is near object?



                        2.   convert  0  to  text


                        3.      0   =      50






                 PROGRAMS USING DIFFERENT PLAYGROUNDS

                 In this section, you will create programs to help your robot move through different playgrounds.
                 Each playground  has a unique  layout  that  challenges you  to  plan and code  the robot’s
                 movement carefully.

                 Coral Reef Cleanup
                 In  the VEXcode  VR  simulation,  the  coral reef environment  teaches  about  the  importance  of
                 keeping oceans clean. The robot is programmed to collect trash from the seabed, showing how
                 technology can help protect marine ecosystems and promote environmental awareness.



                                                                         Sensors, Logic and Maze Navigation
                                                                                                                    91
   88   89   90   91   92   93   94   95   96   97   98