Microbit Digital Art
Intermediate
60 mins
Teacher/Student led
95 points
What you need:
Chromebook/Laptop/PC
Microbit

Animation

Embark on a journey to create your own animation using a Microbit. Start by setting up a new project, then add an event handler. You'll then create the first and second frames of your animation using 'show leds' blocks. Finally, test your animation by pressing the A button.
Learning Goals Learning Outcomes Teacher Notes

Live Class Feed

This is a live feed of the latest activity by your students on this lesson. It will update in real-time as they work on the lesson.
Load previous activity

    1 - Create a New Project

    Start by creating a new project. This will be your workspace for building your animation.

    2 - Add an Event Handler

    Next, you need to add an event handler. This tells your Microbit what to do when a certain event happens - in this case, when the A button is pressed. Add the following code:

    input.onButtonPressed(Button.A, function () {
    
    })

    This code creates a new function that will be called whenever the A button is pressed.

    3 - Create the First Frame of Your Animation

    Now, let's create the first frame of your animation. Inside the function you just created, add the following code:

    input.onButtonPressed(Button.A, function () {
        basic.showLeds(`
            . . . . .
            . # . # .
            . . . . .
            # . . . #
            . # # # .
        `)
    })

    This code uses the 'show leds' block to create a pattern on the LED display. This will be the first frame of your animation.

    4 - Create the Second Frame of Your Animation

    Next, create the second frame of your animation. Add the following code right after the first 'show leds' block:

    input.onButtonPressed(Button.A, function () {
        basic.showLeds(`
            . . . . .
            . # . # .
            . . . . .
            # . . . #
            . # # # .
        `)
        basic.showLeds(`
            . . . . .
            . . # . .
            . . . . .
            . # . # .
            # . . . #
        `)
    })

    This code adds a second 'show leds' block to create another pattern on the LED display. This will be the second frame of your animation.

    5 - Test Your Animation

    Finally, test your animation. Press the A button on the simulator to see your animation in action. If you have a physical Microbit device, this step is optional. You can download the code onto your device and test it there.

    Unlock the Full Learning Experience

    Get ready to embark on an incredible learning journey! Get access to this lesson and hundreds more in our Digital Skills Curriculum.

    Copyright Notice
    This lesson is copyright of DigitalSkills.org. 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