Programming with Micro:Bit

This is an eight-session series in which students learn the fundamentals of programming using the Micro:Bit device.  Programming differs from "coding" in depth and breadth.  Students learn "coding" and also some of the science behind software development.  Each session is about 50 minutes.  This series has been presented successfully to 7th graders as one classroom session per week for eight weeks.

Learning Objectives

At the completion of this series, students will be able to describe and apply the following concepts:

  • AlgorithmsVariables
  • Program control structures: sequence, selection, and iteration
  • Coordinate grid systems
  • Boolean expressions and operations
  • Function subprograms
  • Arrays and the concept of indexed storage.

Micro:Bit with one LED illuminated

Equipment

Each student or pair of students will need:

  1. A Micro:Bit micro controller (about $15 to $20 depending on the source.)
  2. Computer, laptop, or tablet with an Internet connection, modern browser, and USB port.
  3. USB type A to micro USB 5-pin cable (about $5.)  Most computers and laptops will have type A USB connectors.  If you are using tablets or other specialized devices, you may need a different cable.

The following URLs must be accessible through the school's firewall: ,

For best results, students or pairs of students should use the same computer, laptop, or tablet at each session because, by default, student work is stored on the local device using the web browser's local storage facility.

Instructional Sessions

  1. Find the Pok茅mon:We learn what an algorithm is and the importance of selecting the right algorithm by searching for each others' Pok茅mon in a game of Find the Pok茅mon.  (Adapted from the Battleship exercise from .)
  2. Shake that Micro:Bit! Exploring, we find that the Micro:Bit comes pre-loaded with a program that includes a simple game. We write our own program to display a smiley face, then change it to display a frown.
  3. Constantly Variable: We investigate variables, then use numeric variables and buttons to write a score-keeping program for Rock Paper Scissors.
  4. Decisions, Decisions! Computer programs can make decisions using the if statement. We'll explore how and write a program that makes decisions.
  5. LoopyLEDs: We look at how computers repeat the same actions over and over using loops, and write a loopy program.  Then we'll use the Micro:Bit to play "Kid Against Machine" in a game of Rock Paper Scissors.
  6. Tilt that LED! Remember that game from the second day where you could "roll an LED" around the grid on the Micro:Bit? Well, it's time for you to start writing that program yourselves.
  7. It's Functional: To make our LED tilting program into a game with a target the player tries to hit, we need to be able to run the same code from two different places. One block of code that can be run from two (or more!) places is called a function. We'll add a function to our program and make a game. We'll also learn a bit about Boolean expressions.
  8. Roll them Bones! "Bones" is a term for dice. Chaucer, whom you may meet in high school, used it in the year 1300 in The Pardoner's Tale. In the last lesson of the series, you'll design your own program to simulate rolling a die. ("Dice" is plural, like "mice." When you have only one, it's a "die.") Then you'll expand your program to simulate two or more dice with a single shake and learn about arrays.