Morse code messenger

A sends a dot, B sends a dash: pairs tap out secret words by radio, decode them with a Morse chart and learn how the telegraph worked.

Go to the code ↓

Lesson at a glance

45 to 60 minutes · Grades 4 to 7

maze.education/microbit/lessons/morse-messenger

Grades
Grades 4 to 7
Time
45 to 60 minutes
The CAPS gives Coding and Robotics 2 hours a week (Coding and Robotics CAPS, Grades 4 to 6, page 22; Grades 7 to 9, page 22).
Level
Some experience
For classes that have used the micro:bit and MakeCode once or twice.
Board
Any micro:bit
Code with
MakeCode blocks, with Python as an extension
CAPS
Coding and Robotics, Social Sciences, Natural Sciences and Technology, Technology
Fits: Grade 6, Term 3 · Where it fits

Learning intentions

Learners will learn to:

  1. Explain how Morse code turns letters into short and long signals.
  2. Send a message by radio and show and sound it on another board.
  3. Agree a protocol (the rules for sending) so the receiver can decode the message.

Success criteria

Each learner can say:

  • I can explain how Morse code turns each letter into short and long signals.
  • I can send a dot and a dash by radio, and show and sound them on another board.
  • I can agree a protocol with my partner and use it to decode a secret word.
  • Grade 7: I can trace what the receiving board shows, and what its user writes down, for a short word.

Competencies

From the Coding and Robotics CAPS places this lesson cites.

  • R.3Outline the different components of a robot
  • D.8Interpret a pattern to represent or communicate a message or image
  • D.9Create a pattern to represent or communicate a message or image

Key words

Morse code
A code that writes each letter as dots (short signals) and dashes (long signals). SOS is ... --- ...
telegraph
A way to send messages along wires using electricity. Telegraphs that used Morse code spread around the world from the 1840s.
encode
To turn a message into a code.
decode
To turn a code back into the message.
protocol
The rules both sides agree, such as a pause between letters.
trace table
A table that follows the value of each variable, step by step, as a program runs.

What you need

  • Two micro:bits for each pair, with USB cables and battery holders
  • A computer with Chrome or Edge for each pair
  • A printed Morse code chart for each pair, and paper to write the dots and dashes

From our shop: BBC micro:bit V2 Club Pack, BBC micro:bit V2.21 Next Gen Classroom Pack

Safety

  • Keep the volume low and the micro:bit away from ears. Someone may be sensitive to sudden sounds, so warn the class before the first sound plays.
  • Keep USB cables tidy on the desk so nobody trips over them or pulls a laptop off the table.
  • Use the battery holder with two AAA batteries. Never mix old and new batteries, and take the batteries out before the kits are packed away.

The lesson plan

One lesson of 45 to 60 minutes in three parts: introduction, lesson development and consolidation. The CAPS gives Coding and Robotics 2 hours a week, so it fits one of the week's lessons. Times are a guide.

  1. Introduction

    5 to 10 minutes
    Retrieval practice

    What does a red flag on a beach tell swimmers, and how does it work without any words? (It is not safe to swim. It works because everyone has agreed what the flag means.)

    Problem statement

    Long before cellphones, urgent news crossed South Africa by telegraph in Morse code, and where there is no signal a torch or a whistle can still send SOS that way. Build a two-board Morse messenger, agree the rules for sending, and decode each other's secret words.

    1. Ask: how did people send urgent news across the country before phones? Show a picture of a telegraph key and a Morse chart. Tap SOS on the desk: three short, three long, three short. Ask the class to write what they heard as dots and dashes.
    2. Read the problem statement. Ask: what must the sender and the receiver agree before a code like this can work?
  2. Lesson development

    35 to 40 minutes
    1. Unplugged first. In pairs, sit back to back. One learner taps a three-letter word on the desk (a short tap for a dot, a long scrape for a dash, a pause between letters). The other writes the dots and dashes and decodes it with the chart. Swap and try a longer word.
    2. Plan on paper first. Give each pair a radio group number from 0 to 255. Pairs fill in the IPO table, write the algorithm and agree their protocol: wait two seconds between letters, and raise a hand at the end of a word. Grade 7 learners add the trace table for the word TEA.
    3. Predict. Ask: when you press A, what will your own board show? What will the other board show and sound? How much longer will a dash beep than a dot?
    4. Build in blocks. Pairs share one computer. The driver builds the program from the Blocks tab, with the pair's group number instead of 3; the navigator checks each block against the IPO table. Swap roles halfway, after step 3, so the new driver builds the dot and the dash. Download it to both boards.
    5. Test and debug. Press A on one board: the other board shows a dot and, on a micro:bit V2, beeps briefly. Press B: a line and a longer beep. Did it match your prediction? If nothing arrives, check both group numbers. If a dash arrives as a dot, check the hyphen in radio send string.
    6. Send three secret words each, following your protocol. The receiver writes the dots and dashes, decodes them with the chart, and checks with the sender.

    Plan on paper: a model answer

    In pairs, fill in the IPO table for both boards, write the algorithm and agree a protocol. Grade 7 learners also trace the receiving board for the word TEA.

    Algorithm
    1. Set the radio group to the pair's number.
    2. When A is pressed, send a dot by radio. When B is pressed, send a dash.
    3. When a dot arrives, light the centre light and beep for 150 milliseconds.
    4. When a dash arrives, light three lights across the middle and beep for 450 milliseconds.
    5. Clear the screen, ready for the next signal.
    IPO table
    InputProcessingOutput
    Button A is pressedSend the string . (a full stop) by radioNothing on this board; a dot on the other
    Button B is pressedSend the string - (a hyphen) by radioNothing on this board; a dash on the other
    A message arrives by radioIf it is a full stop, light the centre for 150 ms; if it is a hyphen, light three lights for 450 ms; then clearA dot or a dash, seen and, on a micro:bit V2, heard
    Trace table
    Grade 7: the receiving board as the sender taps TEA (- . .-), keeping to the protocol.
    The senderSent by radioThe receiver showsBeep (ms)The receiver's paper
    Presses B-Three lights across the middle450-
    Waits two secondsNothingNothingNone- (T)
    Presses A.The centre light150- (T) .
    Waits two secondsNothingNothingNone- (T) . (E)
    Presses A.The centre light150- (T) . (E) .
    Presses B-Three lights across the middle450- (T) . (E) .-
    Raises a handNothingNothingNone- (T) . (E) .- (A): TEA
  3. Consolidation

    5 to 10 minutes
    1. Ask: which letters were easy to send? Why do E (.) and T (-) have the shortest codes? (They are the most common letters in English.)
    2. Ask: what went wrong when you forgot the pause between letters?
    3. Back to the problem: what is the same and what is different between the telegraph and sending a text message today? Could your messenger carry a message where there is no cellphone signal? Learners check themselves against the success criteria.

Build it, step by step

Pairs build the program in blocks, following the numbered steps, with the same program as text beside them to check against or paste. Test in the simulator before sending it to a board.

Two boards in radio group 3: A sends a dot and B sends a dash. The receiver shows a dot as one centre light with a 150 millisecond beep, and a dash as three lights across the middle with a 450 millisecond beep.
Dots and dashes travel by radio; the receiving board shows and sounds each one so the pair can decode the letters with a Morse chart.

These are the MakeCode steps. The other routes are on the lesson's web page.

Build it in MakeCode blocks

  1. Start a New Project called Morse. Put radio set group 3 in on start, with your pair's number.
  2. From Input, add on button A pressed with radio send string "." (a full stop). Add on button B pressed with radio send string "-" (a hyphen).
  3. From Radio, add on radio received receivedString. Inside, add if then else if from Logic: if receivedString = "." then, else if receivedString = "-" then.
  4. For the dot: plot x 2 y 2 from Led, then play tone from Music with Middle E and until done. The beat menu has no milliseconds, so drop the round 0 block from Math over 1 beat and type 150.
  5. For the dash: three plot blocks for x 1, 2 and 3 on y 2, a short line, and play tone Middle E until done, with a 0 block from Math set to 450 over the beat. A dash lasts three times as long as a dot, as in real Morse code.
  6. After the if, add clear screen. Test in the simulator (it shows two boards), then Download to both micro:bits.
The same blocks as text (to paste into MakeCode)
input.onButtonPressed(Button.A, function () {
    radio.sendString(".")
})
input.onButtonPressed(Button.B, function () {
    radio.sendString("-")
})
radio.onReceivedString(function (receivedString) {
    if (receivedString == ".") {
        led.plot(2, 2)
        music.play(music.tonePlayable(330, 150), music.PlaybackMode.UntilDone)
    } else if (receivedString == "-") {
        led.plot(1, 2)
        led.plot(2, 2)
        led.plot(3, 2)
        music.play(music.tonePlayable(330, 450), music.PlaybackMode.UntilDone)
    }
    basic.clearScreen()
})
radio.setGroup(3)

To use the text instead: open MakeCode, start a new project, click JavaScript at the top, replace what is there with this code, then click Blocks to see it as blocks.

To send it to the board, click Download. In Chrome or Edge, MakeCode can connect to the micro:bit by USB so the program goes straight onto it. Otherwise a .hex file downloads: drag it onto the MICROBIT drive.

Extension or homework

Challenges for learners who finish early, or to take further in a club or as homework.

  1. Challenge 1

    Add a third button signal: A and B together send a slash for the end of a word.

  2. Challenge 2

    Build a decoder: store the dots and dashes in a text variable, and when the slash arrives, show the letter for the codes you know.

  3. Challenge 3

    Time how long it takes to send your name in Morse code, then to type it on the computer. How many times faster is the computer?

Support and extension

Support

For learners who need more help

  • Give pairs a short list of easy words made from E, T, A, N, I and M, and a chart with only those letters.
  • Let the sender say the letter out loud after sending it, until the receiver gets the hang of it.

Extension

For learners who are ready for more

  • Show the sender what they sent too, so they can check their own message.
  • Make the receiver count the signals in each letter and show the count, as a first step towards a decoder.

Informal assessment

Ask these as learners work. Informal assessment happens every day and is not recorded.

  1. What does a dot mean in Morse code, and what does a dash mean?
  2. Write your name in Morse code using the chart.
  3. What travels by radio when you press A?
Exit question

Why do sender and receiver need to agree a protocol before they start?

Observation checklist

Watch pairs as they plan, build and test. Write each pair's initials under the level you see.

Watch forBeginningDevelopingAccomplishedExemplary
Encodes and decodes words correctly with the chart.
Matches each input in the IPO table to a block in the program.
Keeps to the agreed protocol when sending.
Checks the radio group and the characters sent when a signal goes wrong.
Beginning:
not yet, even with help
Developing:
with help
Accomplished:
on their own
Exemplary:
on their own, and explains it or takes it further

The four levels are the CAPS rubric levels (Coding and Robotics CAPS, Grades 4 to 6, page 176; Grades 7 to 9, page 163). The short descriptions are ours.

This lesson is not a formal task, but it is good practice for the term's practical task in Grades 4 to 6 (Coding and Robotics CAPS, Grades 4 to 6, page 170), and for the mini-PATs in Grades 7 to 9 (Coding and Robotics CAPS, Grades 7 to 9, page 157).

Common mistakes and fixes

  • Problem: Nothing arrives on the other board.Fix: Check both boards have the same radio group and were both given the new program.
  • Problem: The dash arrives as a dot.Fix: Check the text in radio send string for B is a hyphen "-", the same character the receiver checks for.
  • Problem: Letters run together and cannot be decoded.Fix: Leave a two-second pause between letters, and write a space on paper at each pause.

Where it sits in CAPS

  • Coding and RoboticsFitsGrade 6, Term 3: Morse code on the micro:bit, as a pattern that communicates a message.Source: Coding and Robotics CAPS, Grades 4 to 6 (opens in a new tab), Grade 6, Term 3, Digital Concepts, D.9 Create a pattern to represent or communicate a message or image, page 159: Microcontroller with microcontroller app, e.g., road signs, morse
  • Coding and RoboticsFitsGrade 4, Term 2: a pattern that stands for a message, like the CAPS beach flags. Morse code does it with short and long signals.Source: Coding and Robotics CAPS, Grades 4 to 6 (opens in a new tab), Grade 4, Term 2, Digital Concepts, D.8 Interpret a pattern to represent or communicate a message or image, page 77: Albert uses flags to send them messages
  • Coding and RoboticsFitsGrade 7, Term 3: sending a message from one micro:bit to another by radio.Source: Coding and Robotics CAPS, Grades 7 to 9 (opens in a new tab), Grade 7, Term 3, Robotics, R.3 Outline the different components of a robot, page 79: The learners are introduced to the concept of message passing between two devices.
  • Social SciencesGrade 4 History: communication through time, including the telegraph.Source: CAPS Social Sciences, Grades 4 to 6 (opens in a new tab), Grade 4, History, Term 4: Communication through time: How communication has changed over time, and how many forms of communication have stayed the same.
  • TechnologyFits Technology: a communication system with an input, a process and an output on two devices.

Coding and Robotics quotes come from the Department of Basic Education's final CAPS, with the page number of the 2024 printed edition (the Department's October 2025 library copies number their pages differently). Schools may teach a topic in another term: the CAPS leaves the order to each school's annual teaching plan.

Ready to teach it?

Get a micro:bit for every learner or pair, and let us train your staff to run lessons like this one.

More lessons

All lessons →
  • Grades 4 to 7

    Grades 4 to 745 to 60 minLevel: Getting started

    Step counter

    Every step adds one: learners use a variable to count steps, show the total and reset it, then test how accurate it is.

    Subjects: Coding and Robotics · Mathematics · Life Skills · Life Orientation

    Code with: MakeCodePurple MashPython

  • Grades 4 to 7

    Grades 4 to 745 to 60 minLevel: Some experience

    Music maker

    Buttons play notes, A and B together play a scale and a shake starts a tune: a pocket instrument learners compose for.

    Subjects: Creative Arts · Coding and Robotics

    Code with: MakeCodePurple MashPython

  • Grades 4 to 7

    Grades 4 to 745 to 60 minLevel: Some experience

    30-second fitness challenge

    Press A, count down, and the micro:bit counts your star jumps for 30 seconds using its motion sensor.

    Subjects: Life Skills · Life Orientation · Coding and Robotics · Mathematics

    Code with: MakeCodePython

micro:bit is a trade mark of the Micro:bit Educational Foundation, and BBC is a trade mark of the British Broadcasting Corporation. Maze Education is an independent reseller of genuine BBC micro:bit products. Our teacher training and our other products and services are our own, and are not endorsed by the Foundation or the BBC.

WhatsApp