Moving the LED with Microbits

In this project, you and a partner will code a program that can make an LED move left, right, and up on the microbit screen. By pressing combinations of the ‘a’ and ‘b’ buttons, the LED should move around on the screen. This will act as a precursor lesson to more complicated game

OVERVIEW

Activity Overview:

In this project, you and a partner will code a program that can make an LED move left, right, and up on the microbit screen. By pressing combinations of the ‘a’ and ‘b’ buttons, the LED should move around on the screen. This will act as a precursor lesson to more complicated game

Meta description

  • Subject Area: Computer Science, Technology
  • Grade Level : 6-8
  • Computer Science Domains:
    • Computing Systems, Algorithms and Programming
  • Computer Science Principles:
    • Collaborating Around Computing, Recognizing and Defining Computational Problems, Creating Computational Artifacts, Testing and Refining Computational Artifacts
  • Materials:
    • Micro:bit
  • Considerations:
    • It seems that makecode requires you to create a variable to store the “create sprite” block in instead of being able to create a sprite with a single block.

Lesson Plan

Overview

In this project, you and a partner will code a program that can make an LED move left, right, and up on the microbit screen. By pressing combinations of the ‘a’ and ‘b’ buttons, the LED should move around on the screen. This will act as a precursor lesson to more complicated game

ASSESSMENT PRE/POST-TEST

What are the different ways you can make an LED light up on the microbit? How many different ways can you physically interact with a mircobit to give it an input? How does the 5x5 LED screen limit your ability to create different games?

OBJECTIVES

Create a sprite within a variable Code the sprite to move left, right, and up and down when given different physical inputs. Identify limitations of the physical build of the microbit.

CATCH/HOOK

Have two students play a quick game of pong against each other on the computer browser. Discuss what code might have been needed to create a game like pong.

ACTIVITY INSTRUCTIONS

Use makecode.microbit.org to create a coded messaging program that can send coded messages to other microbits.

BEFORE YOU BEGIN CODING: Find the following blocks of code, right click on them, and select the “help” option. Then read the documentation for that block so that you understand how it works! You will have to search through the block options on the left side of the screen to find each of these. “Set ‘variable’ to.. ” block (to see this option you may need to create a variable first) “Create sprite at x:__ y:__” block “Sprite change x/y by ___” block “On button ‘a+b’ pressed” block “On shake” block

Your program should do the following: Create a variable to store the information for a sprite. Create a sprite at x=2 and y=5 named ‘player’ Move the sprite right when the ‘b’ button is pressed, left when the ‘a’ button is pressed, up when ‘a+b’ are pressed, and down when the microbit is shaken.

EXTENSION ACTIVITY: Look through the other blocks of code in the ‘game’ tab on the left side of the screen. Experiment with some of these blocks and see if you can make your game more complicated.

Supplements

Any items in this section are the property & under the license of their respective owners.

REVIEW

Have a class discussion on what they were able to accomplish. Discuss what other aspects of a video game they would want to include and how they might be able to code that within the limitations of a microbit.

STANDARDS

TypeListing
CS DomainsComputing Systems, Algorithms and Programming
CS PrinciplesCollaborating Around Computing, Recognizing and Defining Computational Problems, Creating Computational Artifacts, Testing and Refining Computational Artifacts
Other Content Standards