Page 57 - RoboGenius Pro C5
P. 57

STEP - 9   Drag  the  set hand  to 0  block inside  the  on  shake  block  From the
                               Variables category.

                               This creates a variable to store a random value.


                                                         on  shake


                                                           set  hand   to  0



                  STEP - 10   Drag the pick random 0 to 10 block from the Math category and place

                               it inside the set hand to 0 block and change the range to 0 to 2.


                                                on  shake

                                                 set   hand   to  pick random  0  to  2



                  STEP - 11   Drag the if else block from the Logic category and place it below the on

                               shake block.

                  STEP - 12   Click the plus (+) icon on the block to add an else if section.


                                               on  shake

                                                set  hand   to   pick random  0  to  2

                                                       true
                                                 if   true   then

                                                 else if  false  then


                                                 else





                                                                            on  shake

                                                                             set  hand   to   pick random  0  to  2
                  STEP - 13   Drag  the  0 = 0  block  from the              if     hand   =     0    then

                               Logic category and place it in the
                               first if condition.                           else if  false  then


                                                                             else








                                                                             Creative Projects with Micro:Bit
                                                                                                                    55
   52   53   54   55   56   57   58   59   60   61   62