Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 79 - Ai Robogenius
P. 79

    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
                                                                                                                        77

| 74 75 76 77 78 79 80 81 82 83 84 |