Micro:bit - Apple Worm Doctor

by iga.mandat in Craft > Art

419 Views, 0 Favorites, 0 Comments

Micro:bit - Apple Worm Doctor

Screenshot 2019-12-09 at 11.05.14.png

Instead of playing rock, paper, scissors I have another version of that! Today I will show you how to create your very own designed apple, worm, doctor! It's very simple to play and very simple to make!

What You Will Need

- A Micro:bit chip

- usb cord and battery to the micro:bit

- A computer

-The website makecode.org

Go to the Website

Screenshot 2019-11-28 at 15.00.56.png

Search up the following website: makecode.org

Screenshot 2019-11-28 at 15.03.23.png

When you get to the website you will see "micro:bit" and then click "start coding" under the collum.

Screenshot 2019-11-29 at 13.12.16.png

You will see an icon where it says "New Projects" and when you see it click on it.

Screenshot 2019-12-02 at 10.39.39.png
Screenshot 2019-12-02 at 10.57.44.png

When you are in the page you will see this. Click the category that says "input" and select "on shake". So your micro:bit will know what to do when you shake it. You can delete the one that says "forever" because you won't need it.

Screenshot 2019-12-02 at 10.59.55.png
Screenshot 2019-12-02 at 11.06.39.png

Add a hand variable and place the "set hand to.." block in the shake event.

Screenshot 2019-12-05 at 08.53.41.png

Press the category "Math" and select "Pick random" block to pick a random number from 1 to 3 and store it in the variable named hand. In a later step, each of the possible numbers (1, 2, or 3) is matched to its own picture. The picture is shown on the LEDs when its matching number is picked.

Screenshot 2019-12-06 at 13.10.40.png

Click the category "Logic" and place an "if true then" block under the "pick random" block and check whether hand is equal to 1. Then press the category "Basic and add a "show leds" block that shows a picture of an apple. The number 1 will mean apple.

Screenshot 2019-12-05 at 09.06.31.png

When you click on the button "shake" in the simulator you should see the apple you just made.

Screenshot 2019-12-05 at 09.14.06.png
Screenshot 2019-12-05 at 09.19.15.png

Click the (+) button to add an else section and add a "show leds" block inside the "else" block. Make a picture of a worm. Press the (+) button again to add an "else if" section. Now, add a conditional block for "hand = 2" to the condition in "else if". Since hand can only be 1,2 or 3, your code is covering all possible cases.

Screenshot 2019-12-09 at 10.31.48.png

Press "Basic" and get one more "show leds" block and put in the "else if". Make a picture of a smile that will represent the doctor in the LEDs.

Click on the shake button to make sure that each picture is showing up.

Screenshot 2019-12-09 at 10.36.32.png

Go the category "Basic" again and press on "show string "Hello!". Place that block in to the "on start" event. When you have that you can change the text to "HAVE FUN" and then it you will see that message on the start.

Screenshot 2019-12-09 at 10.43.19.png

Press the category "Loops" and choose "repeat 4 times do". Put that also in the "on start" under the "show string "HAVE FUN". Change the 4 to a 2 like on the picture.

Screenshot 2019-12-09 at 10.44.22.png

Go the category "Basic" again and press on "show string "Hello!". Place that block in to the "repeat 2 times do" event. When you have that you can change the text to "!!".

Screenshot 2019-12-09 at 10.49.14.png
Screenshot 2019-12-09 at 10.48.57.png

Click on "Advanced" and then the category "Control". When you have pressed that you will see a block where it says "run in background".

Screenshot 2019-12-09 at 10.51.51.png
Screenshot 2019-12-09 at 10.48.41.png

Go to the category "Music" and collect the block where it says "start melody dadadum repeating once". When you have that press on "dadadum" and switch to "funk". Then press on "once" and change to "forever" so it's repeating forever in background.

Screenshot 2019-12-09 at 11.06.52.png

Now you are done with programing, now you only need to download it and put it on your Microbit.

Click the download button in the left corner.

Screenshot 2019-12-09 at 11.09.44.png
Screenshot 2019-12-09 at 11.10.16.png
Screenshot 2019-12-09 at 11.10.47.png

It will appear a small icon in the bottom right corner showing you that the download is complete. Click the text that says "Show in folder". You will see a file that says "microbit-Untitled(.).hex", drag the file to the category that says "Microbit". When you are done with that step you will wait for approximately 3-7 minutes and you will be done with your coding and now you can play!

apple.jpg

Here are the rules if you didn't know!! ;)