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
Prerequisites
No previous coding experience required.

MicroPython 101 Lesson Plan

Lesson: Morse Code
Time: 45+ mins

Introduction

Did you know that Morse Code is a sequence of short and long tones that's used to encode letters? It was first used in the 1830s to send and receive messages and is still used today! Here's an example of the famous SOS Morse code message that's used as a distress signal: …---...

In this lesson, students will learn new radio functions as they create their own Morse Code project! Additionally, they'll review radio functions as they program micro:bits that can send and receive Morse Code. How it works: One micro:bit will receive and display messages, while another micro:bit will be programmed to send messages when the user presses the micro:bit's button A and button B.

New Code

  • radio.on() : This radio function turns on the radio.
  • radio.send() : This function broadcasts messages to other micro:bits.
  • radio.receive() : This function receives messages and returns messages to other micro:bits.

Vocabulary

  • None

Objectives

Students will...

  • Apply coding concepts to solve challenge activities
  • Create a Morse Code project using the micro:bit

Materials

  • 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)

  • Tell students that they are going to learn how to create their own Morse code device to send and receive messages using micro:bits! Next, ask if anyone knows what Morse code.
  • Explain that Morse code is a way to communicate and send messages without using words. Instead, Morse code uses a 'dit' signal (short) and 'dah' signal (long) to show the alphabet letters and numbers.

Activities (45 minutes)

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

  • Students will read a short document that introduces the lesson.
  • Students will learn that they're going to create a Morse Code project using at least two micro:bits. One micro:bit will receive messages and display the 'dit' and 'dah' signals on its screen. The other micro:bit will be programmed to send messages to the other micro:bit when the user presses button A and button B.
  • Point out to students that after they finish programming their project, pressing button A will send a 'dit' (short) signal, and pressing button B will send a 'dah' (long) signal. To send an 'end' signal, students will need to press both buttons at the same time.

2. Sending the Signal (DIY)

  • Coding Challenge, Step 1: Sending Signals
    • To solve this challenge, students need to finish the provided code and add conditional statements to make their micro:bit send signals.
    • Give a hint: Ask students, "What function should we use to send messages?" (Answer: radio.send()).

3. Receiving the Signal (DIY)

  • In this module, students will program a second micro:bit to receive the signal.
  • Point out to students that the micro:bit will accept and store all messages that it detects. However, they need to have the micro:bit retrieve a message--otherwise, the messages will remain stored.
  • Emphasize to students that if the micro:bit has more than one message in its queue, it'll retrieve the oldest message first. Also point out that if radio.receive() is called when there are no messages (i.e., the queue is empty), then it'll return None. Students will need to know this for the quiz.
  • Coding Challenge, Step 2: Receiving Signals
    • To solve this challenge, students need to finish the provided code to make their micro:bit receive signals.
    • Are students struggling? Suggest that they first figure out what image strings display a circle, line, and dot:
      - Circle image string: '00000:09990:09990:09990:00000'
      - Line image string: '00000:99999:99999:00000:00000'
      - Dot image string: '00000:00000:00000:00900:00000'

4. Combine Sending and Receiving (DIY)

  • Coding Challenge, Step 3: Combining Send and Receive
    • To solve this challenge, students will need to combine their code from the first two challenges so that each micro:bit can send and receive Morse code.
    • Point out to students that they can use their code solutions from the previous challenges.
    • If students finish early, ask them to try the bonus tasks, which encourage them to connect a speaker and display an animation.

5. Sending Messages (DIY)

  • This module instructs students to experiment with their code as they test and debug their Morse Code project.
  • Make sure the micro:bits are able to send and receive messages. If they're not, move the micro:bits closer to each other.
  • Optional: Ask students to send a mystery word (e.g., cat, bear, apple) to a friend using Morse code. Can they figure out the mystery word? Note: They might need to use pencil and paper to keep track of the 'dits' and 'dahs'.

6. Review

  • This page reviews the following:
    • The import radio function imports the radio library.
    • To turn the radio on, use the radio.on() function.
    • The radio.send(text) function receives and returns the micro:bit's oldest message.
    • The radio.receive() function receives and returns the micro:bit's oldest message.

7. Quiz (Multiple-choice)

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

Extended Activities (10 minutes)

Lead a discussion with your students:

  • Who can describe what Morse code is?
  • What are some benefits of knowing Morse code?
  • What's one piece of advice you'd give someone who's about to take the MicroPython 101 course?
  • What's something you enjoyed learning in the MicroPython 101 course?

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.