Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 54 - RoboGenius Pro C5
P. 54

    STEP - 10   Drag the show number block and place it below                   on  shake

                                     the change steps by 1 block.
                                                                                                     change steps   by  1
                       STEP - 11   Drag  the  steps  variable from the  Variables                    show number steps
                                     category  and place  it  inside  the  show  number

                                     block.

                                     This will display the total number of steps counted on the LED display.

                                     Your block-based code will look like this.

                       STEP - 12   Click on the Shake button to run the program.

                      You can also download the code to your Micro:bit by clicking the Download button in

                      MakeCode then connect the Micro:bit to your computer and transfer the file.

                      Output

                      When the program runs, the Micro:bit starts counting steps using its accelerometer
                      sensor. Each time  you  shake  or move  the  Micro:bit,  the  accelerometer  detects

                      the motion and increases the step count by one. The total number of steps is then
                      displayed on the LED display using numbers.

                                     RoboGenius Pro - V
                     52

| 49 50 51 52 53 54 55 56 57 58 59 |