6. Case 06: Create A Magic Wand

6.1. Purpose


  • To create a magic wand with multiple functions.

6.2. Materials


6.3. Background


In case of any emergencies and incidents, Xiao En decides to set all the functions to the magic wand. Only in this way can he and his team use the magic power in a quick way and also succeed in the trial.

6.4. Software


SoftwareMakeCode

6.5. Programming


Programme as the picture shows:

../../_images/magicwand_case_06_07.png

Result


  • [x] After powering on, the strip lights in blue and the functions can be switched from pressing button A/B or tilting the micro:bit. After pressing button A, it shows a smile face; after pressing button B, it switches to the recharging mode, if the LEDs are all in red, they can turn to blue by pressing the button connecting to P2; while tilting the micro:bit to the right side, it switches to the function of beating over the spider or letting the flying saucer take off; while tilting to the micro:bit to the left side, it switches to the function of sending “land off” command to the flying saucer; after setting the magic functions ready, press the button connecting to P2 to release the magic, kindly note that the last blue LED will turn to red each time after you release the magic power, which means the magic power doens’t work if there is no blue LED lighting on, at this time you will have to recharge your magic wand to start this function and kindly note only all the LEDs turn to blue will the recharging be finished or it fails to recharge with the strip in red.

6.6. Exploration


6.7. FAQ


6.8. Relevant File