Microbit
Beginner
30 mins
120 points
What you need:
  • Computer/laptop

Emojis

Is our Microbit happy or sad? In this lesson we make it show lots of different faces.

1 - Create a new Microbit project

Go to the makecode.com website and start a new Microbit project.

2 - Show the asleep face

In this lesson we're going to make our Microbits show different faces. At start let's show the asleep face, add the following code.

basic.showIcon(IconNames.Asleep)


3 - Make it happy

Now let's program the A button to make our Microbit happy by showing the happy face. Add the following code.

input.onButtonPressed(Button.A, function () {
    basic.showIcon(IconNames.Happy)
})

4 - Make it sad

Now let's program the B button to make our Microbit sad by showing the sad face. Add the following code.

input.onButtonPressed(Button.B, function () {
    basic.showIcon(IconNames.Sad)
})


5 - Make it meh

The meh face is not quite happy and not quite sad, just kind of in between! Add the following code.

input.onButtonPressed(Button.AB, function () {
    basic.showIcon(IconNames.Meh)
})

Join our club 😃

To view the remaining 4 steps and access hundreds of other coding projects please login or create an account.

Copyright Notice
This lesson is copyright of Coding Ireland. Unauthorised use, copying or distribution is not allowed.
Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more