2. Case 02: Call the Team Members Together

2.1. Purpose


  • To create a magic wand that can send signals to the flying saucer.

2.2. Materials


2.3. Background


Though the guard of the insects is expelled, the battle alarms their nest with so many insects coming out. Xiao En and his team members can do nothing but to leave bewilderingly. They arrive at a safe place but are lost with each other, let’s create a magic wand to send signals for calling the members together.

2.4. Software


SoftwareMakeCode

2.5. Programming


Step 1

Click “Advanced” in the MakeCode drawer to see more choices.

../../_images/magicwand_case_01_02.png

We need to add a package for programming, . Click “Extensions” in the bottom of the drawer and search with “magicwand” in the dialogue box to download it. (Kindly note this package is still in the verifying process and pls search with “https://github.com/elecfreaks/pxt-magicwand “ before it’s ready)

../../_images/magicwand_case_01_03.png

Note: If you met a tip indicating that the codebase will be deleted due to incompatibility, you may continue as the tips say or build a new project in the menu.

Step 2

Drag and set the infrared sending connection to P1 in the on start block.

../../_images/magicwand_case_02_04.png

Step 3

Drag the while tilting to the right side block, programme inside with the block if the button in P2 is pressed, then set the magic level as primary and then release the magic once.

Drag the while tilting to the left side block, programme inside with the block if the button in P2 is pressed, then set the magic level as advanced and then release the magic once.

../../_images/magicwand_case_02_05.png

Result


  • If the magic wand tilts to the right side, press the button to take off the flying saucer.

  • If the magic wand tilts to the left side, press the button to land off the flying saucer.

2.6. Exploration


2.7. FAQ


2.8. Relevant File