Page 55 - RoboGenius Pro C7
P. 55

HIDDEN PIXEL ART

                 Hidden Pixel Art is an activity where students program a robot to detect colours using sensors. The
                 robot moves across a virtual grid, gradually revealing a hidden design or pattern.
                 The code and output are as follows:




                    when started

                    clear all rows

                   set drive velocity to 100  %

                    set turn velocity to 100  %

                    drive  forward  for  1600  mm

                    turn  right  for  90  degrees

                    repeat  8

                      set cursor to next row

                      repeat  8

                       if   DownEye    detects green  ?  then

                         set print color  green


                         print  X
                       else

                         set print color  blue

                         print  X



                       drive  forward  for  200  mm



                      drive  reverse  for  1600  mm


                      turn  right  for  90  degrees

                      drive  forward  for  200  mm

                      turn  left  for  90  degrees



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



                                                                           Getting Started with VEXcode VR
                                                                                                                    53
   50   51   52   53   54   55   56   57   58   59   60