Page 52 - RoboGenius Pro C4
P. 52

STEP - 6    Drag the set iconState to 0 block from the Variables category and

                                  place it into on shake block.





















                    STEP - 7    Drag the pick random block from the Math category and place it in the
                                  set iconState block. Change the numbers in the pick random block to

                                  0 and 2 so that the program picks a random number between 0 and 2
                                  when the Micro:bit is shaken.






















                    STEP - 8    Drag the if-else block from the Logic category and place it below the
                                  set iconstate block.
                                  Similarly, drag the remaining blocks into the workspace to complete

                                  the code. Your block-based program should now look like this.






















                                 RoboGenius Pro - IV
                 50
   47   48   49   50   51   52   53   54   55   56   57