MicroPython 101

A project-based introduction to micro:bit programming using MicroPython with instructions to build 16 hands-on micro:bit projects. Request Quote

  • Grades 6 - 8
  • 14 lessons
    • Web
  • Python
  • Advanced Course
Course includes
  • 14 lessons
  • 86 activities
  • Enhanced Creativity Tools
  • Automatic Assessment
  • Tutorials and Reviews
  • Coding Puzzles
  • DIY Projects
  • Quizzes
  • Teacher Guides
  • Answer Keys
No previous coding experience required.

MicroPython 101 Lesson Plan

Lesson: Dodgeball
Time: 45+ mins


In this lesson, students will learn how to program their micro:bit into a dodgeball game. How to play: Move the character (one LED) left and right by pressing button A and button B on the micro:bit. The goal of the game is to avoid the objects that will continually fall from the top of the micro:bit's LED display.

Note: These functions are Tynker specific: move_paddle(), add_ball(), move_balls(). If students try using these functions in Python projects beyond the MicroPython 101 course, they will not work.

New Code

  • move_paddle() : Move the paddle to the right or left of the LED display.
  • add_ball() : Create a new ball.
  • move_balls() : Move the ball down.
  • reset() : Restart the micro:bit.


  • Array: Stores multiple values into one single variable


Students will...

  • Use the micro:bit to run coding examples
  • Apply coding concepts to solve challenge activities
  • Create a dodgeball game using the micro:bit


  • micro:bit device (recommended 1 per student)
  • USB cable
  • Computers, laptops, or Chromebooks (1 per student) with student account access to Tynker.com

Warm-Up (5 minutes)

  • Review functions with your students. Ask, "What does the ______ function do?" Here's a list of suggested functions to review: display.show(), display.scroll(), display_clear(), button_a.was_pressed(), button_b.was_pressed(), and sleep().
  • Explain to students that they'll have more practice using these functions in today's coding activity as they learn how to program a dodgeball game!

Activities (45 minutes)

Facilitate as students complete all Dodgeball modules on their own:
1. Dodgeball (Document)

  • Students will read a short document that introduces the chapter. In this lesson, they'll learn how to code a dodgeball game using their micro:bit. How to play: Blocks will fall from the micro:bit's top LED display. Students will need to dodge the falling objects by moving their character (a tiny LED) left and right.

2. Showing and Moving Your Character (DIY)

  • In this module, students will learn how to program the micro:bit to display their character and make it move left and right when the user presses a button or tilts their micro:bit.
  • Students are introduced to arrays, which are used to store multiple values into one single variable. Here's an example that gets the last 5 digits of the grid_image string:

  • Coding Challenge, Step 1: Moving your Character
    • To solve this challenge, students need to program their micro:bit to show an image that the user can move left and right.
    • Make sure they read the requirements carefully.
    • Most of the code is provided for your students. They'll need to finish the solution, starting at the comment that says "### YOUR CODE HERE."
    • Tell students that move_paddle(-1) will move the character one space to the left, and move_paddle(1) will move the character one space to the right.
    • Give a hint: Tell students to use an if-elif loop and include the button functions. Make sure they also include a display.show() function to display the string.

3. Dropping Balls (DIY)

  • Students are introduced to the add_ball() and move_balls() functions. The add_ball() function creates a new ball and the move_balls() function moves all balls down the LED display.
  • Make sure students analyze the completed code in "Example 1," which shows them how to create and move balls down their micro:bit.
  • Coding Challenge, Step 2: Add and Move Balls
    • To solve this challenge, students need to use move_balls() and add_ball() functions to make their micro:bit add and move balls.
    • Most of the solution is provided for your students. Give a hint: Tell students that they only need to add code inside the forever loop.

4. Finishing the Game (DIY)

  • Make sure students analyze "Read This! Collision Detection," which provides completed code to check if the ball collides with the character.
  • Coding Challenge, Step 3: Turning It All Into a Game
    • Students are instructed to add final touches to their game by programming their micro:bit to display the word "Lose" when the user's character collides with a falling object.
    • To display the word "Lose," students need to use a forever loop and the display.show() function.
    • Are students struggling with the bonus challenges? Ask them to try creating a display_count variable and use conditional statements (e.g., if-else).

5. Review (Document)

  • This page reviews the following:
    • How to manipulate strings
    • How to use the image string as a "game board"

6. Quiz (Multiple-choice)

  • Students will be asked 5 quiz questions to review concepts from this lesson.

Extended Activities (10 minutes)

Lead a discussion with your students:

  • What does an array do? (Answer: Stores multiple values into one single variable.)
  • What was something you struggled with today? Discuss obstacles and successes.
  • Did anyone customize their dodgeball game? How?

U.S. Standards

  • CCSS-Math:MP.1
  • CCSS-ELA: 6-8.RST.3, 6-8.RST.4, 6-8.RST.7
  • CSTA: 2-AP-11, 2-AP-13, 2-AP-15, 2-AP-17
  • CS CA: 6-8.AP.11, 6-8.AP.13, 6-8.AP.15, 6-8.AP.16, 6-8.AP.17
  • ISTE: 1.c, 1.d, 4.d, 5.c, 5.d, 6.b

U.K. Standards

Key Stage 2 (Years 4-6)

  • Design, write and debug programs that accomplish specific goals, including controlling or simulating physical systems; solve problems by decomposing them into smaller parts.
  • Use logical reasoning to explain how some simple algorithms work and to detect and correct errors in algorithms and programs.
  • Understand computer networks, including the internet; how they can provide multiple services, such as the World Wide Web, and the opportunities they offer for communication and collaboration.
  • Use technology safely, respectfully and responsibly; recognise acceptable/unacceptable behaviour; identify a range of ways to report concerns about content and contact.

Key Stage 3 (Years 7-9)

  • Understand several key algorithms that reflect computational thinking [for example, ones for sorting and searching]; use logical reasoning to compare the utility of alternative algorithms for the same problem.
  • Create, re-use, revise and re-purpose digital artefacts for a given audience, with attention to trustworthiness, design and usability.
  • Understand a range of ways to use technology safely, respectfully, responsibly and securely, including protecting their online identity and privacy; recognise inappropriate content, contact and conduct and know how to report concerns.