Skip to content

Latest commit

 

History

History
63 lines (44 loc) · 1.22 KB

tutorial.md

File metadata and controls

63 lines (44 loc) · 1.22 KB

Golden Door

input.onPinPressed(TouchPin.P0, function () {
     
})

Introduction @unplugged

This tutorial will help you solve your first microbit mystery!

Step 1

We need to write code to check whether the user is correct if they touch pin #0.

Put a 'check door' custom block inside of the 'on pin P0 pressed' block that's already on your screen.

input.onPinPressed(TouchPin.P0, function () {
    custom.checkDoor(0)
})

Step 2

Let's write some code to check pin P1.
Do the same thing that we did for P0, but make sure you're checking door 1.

input.onPinPressed(TouchPin.P1, function () {
    custom.checkDoor(1)
})

Step 3

Do the same thing for P2, but check door 2.

input.onPinPressed(TouchPin.P2, function () {
    custom.checkDoor(2)
})

Step 4

Did writing this code help you figure out what you need to do to solve the mystery?

Try running the code here and see if you can answer the mystery!


For extra fun, click |Download| to transfer your code to your microbit!