# Case 03: Coping with Stress ## Purpose --- - To create a magic wand to show a smile face. ## Materials --- ## Products Link --- [Magic Wand Kit](https://shop.elecfreaks.com/products/elecfreaks-micro-bit-magic-wand-kit-without-micro-bit-board?_pos=1&_sid=809c6b940&_ss=r) ## Background --- Xiao En sends out the flying saucer and gets together with his partners, they feel depressed for their first war with the insects enemy. Xiao En finds out a way to rebuild their confidence and face the problems positively. ## Software --- [SoftwareMakeCode](https://makecode.microbit.org/#) ## 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 Choose the variables in the MakeCode drawer and write the letter "i" in the dialogue box to confirm it. ![](./images/magicwand_case_03_04.png) ![](./images/magicwand_case_03_05.png) ### Step 3 Drag the variable brick and set it as 0 into the on start brick. ![](./images/magicwand_case_03_06.png) ### Step 4 Drag the if...else... brick into the forever brick to judge the value of the variable and the status of the button connecting to P2. While "1"=1 and the button connecting to P2 is pressed, it shows a smile face, then set to pause for 500ms and show an icon, at last set the variable as 0. ![](./images/magicwand_case_03_07.png) ### Step 5 Drag the while vibrating brick and set it as 6g, choose the show number brick to show the variable "i" and set it to 1. ![](./images/magicwand_case_03_08.png) ### Link: Link: [https://makecode.microbit.org/_hJwf5WgpT3JH](https://makecode.microbit.org/_hJwf5WgpT3JH) You can also download it directly below:
### Result --- - While shaking the magic wand, it suggests the consuming status of the magic power, then press the button to show a smile face. ## Exploration --- ## FAQ --- ## Relevant File ---