Introduction: Micro:bit - Apple Worm Doctor

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!

Step 1: What You Will Need

- A Micro:bit chip

- usb cord and battery to the micro:bit

- A computer

-The website makecode.org

Step 2: Go to the Website

Search up the following website: makecode.org

Step 3:

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

Step 4:

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

Step 5:

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.

Step 6:

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

Step 7:

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.

Step 8:

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.

Step 9:

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

Step 10:

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.

Step 11:

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.

Step 12:

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

Step 13:

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.

Step 14:

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.

Step 15:

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 "!!".

Step 16:

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

Step 17:

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.

Step 18:

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.

Step 19:

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!

Step 20:

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