Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 68 - Ai Robogenius
P. 68

    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.

                                     AI RoboGenius - IV
                     66

| 63 64 65 66 67 68 69 70 71 72 73 |