Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 124 - 2629_Devagiri_C-8
P. 124

    Block                                          Description
                       set pen to color block    This block  sets  the pen colour to  a specific  value, allowing the
                                                 robot to draw in that colour. You can choose from black, red, green
                        set pen to color black
                                                 and blue.
                       set pen color block       This block  also sets  the  pen’s  colour  but  may  have additional
                                                 functionality for adjusting the colour value directly.
                        set pen color

                       set pen to width block    This block sets the width (thickness) of the pen. You can increase or
                                                 decrease the thickness of the lines the robot draws.
                        set pen to width  thin

                       fill area with color block This block fills an area with a selected colour, essentially colouring in
                                                 a region or shape that the robot has drawn.
                        fill area with color

                      DRAWING BASIC SHAPES

                      In VEXcode VR, you can draw basic shapes such as squares, triangles and circles by programming
                      the robot to move forward/backward and turn in specific directions.

                        Program 3 Draw a hexagon on the Grid Map playground.

                      The task is to make the robot draw a hexagon on the playground (in our case Grid Map) using
                      the Drawing blocks. The code and output of the given task are as follows:

                       when started

                       turn  right  for  90  degrees

                        drive  forward  for  600  mm

                       turn  left   for  90  degrees

                        drive  forward  for  600  mm

                       move pen  down

                       set pen to color green

                        repeat  6

                         drive  forward  for  400  mm

                         turn  right  for  60  degrees

                       122
                            Premium Edition-VIII

| 119 120 121 122 123 124 125 126 127 128 129 |