Session 8: Introduction to Debugging through Simple Mistakes
Duration: 40-50 minutes
Equipment Required:
- M3D Robotics kit with display screen.
- Laptops with the on-screen gamepad pre-loaded.
- Paper and pencils for students to note down their math answers.
- A simple reward (e.g., stickers or stamps) for students who complete the test.
Learning Objectives:
- Learn about “bugs” in the robot’s code.
- Practice finding and fixing simple mistakes in the robot’s movements and text.
- Work with classmates to help each other spot and fix bugs.
- Understand how using the right blocks makes the robot follow the correct instructions.
- Build confidence in fixing errors in simple code by using familiar blocks like move, turn, and show text.
- Have fun while learning how to solve problems by making the robot work correctly.
Resources:
Scratch Code File:
Grade 1 Session 8.sb3 (3.4 MB)
1. Introduction to Bugs and Errors (10 minutes)
Activity:
Introduce the idea of bugs as mistakes in the robot’s instructions that cause it to behave in a funny or unexpected way. Share the story of how “bugs” got their name in the world of computers.
Instructions:
You could start with a fun story:
“Have you ever made a funny mistake, like putting on your socks after your shoes? Well, guess what? Even computers and robots can make funny mistakes, and we call those mistakes ‘bugs.’ But do you know why we call them that? It’s a really cool story!”
- Pause for a moment to let them guess, then share the story:
“A long, long time ago, when people were just starting to use big computers, one of the computers stopped working. When they checked it out, they found the problem—a real bug, like a moth, was stuck inside the machine! Since then, whenever a computer makes a mistake, we call it a ‘bug,’ even if there’s no real bug inside.”
- Make it interactive by asking:
“Can you imagine finding a little bug inside your robot? How funny would that be!”
- Explain that today they’ll be learning how to find and fix “bugs” in their robot’s code, just like the first computer engineers had to do when they found that moth.
Teacher’s Role:
- Get the students excited and laughing about the idea of a real bug causing a computer mistake.
- Help them understand that fixing bugs means helping the robot do the right thing, just like people had to do back when computers were first invented.
2. Identifying Simple Bugs (5 minutes)
Activity:
The instructor will give students a sequence of blocks with a simple “bug” (mistake), like telling the robot to turn left instead of right, or showing the wrong text on the screen.
Instructions:
- Demonstrate a buggy code on the projector, like this:
The bug in this code block is that it makes the robot:
- Move Forward
- Turn Left
- Turn Left(when it should be Turn Right)
“Oops! The robot was supposed to turn right, but it turned left! Can anyone spot the mistake?”
- Encourage students to think about what went wrong and how to fix it.
Teacher’s Role:
- Help students recognize where the robot’s movement went wrong.
- Give hints if needed, such as, “Think about which direction the robot was supposed to go.”
3. Fixing Bugs in Code (20 minutes)
Activity:
Now, students will open the file “Buggy Codes” where there will be some sequences of blocks with small errors and work in pairs to fix the bugs.
Instructions:
- Hand out pre-designed buggy codes for students to fix. For example:
- Ask students to spot the bugs and fix them by dragging and dropping the correct blocks into place.
“Your robot might get confused if it has the wrong instructions. Let’s help the robot by fixing these bugs and see if it can do the right thing!”
Teacher’s Role:
- Move around the room, helping students spot the bugs and encouraging them to fix the errors in their code.
- Provide hints if they struggle by asking questions like, “Which way should the robot turn? What should the screen say?”
4. Create Your Own Buggy Code (15 minutes)
Activity:
After fixing the provided bugs, students will create their own sequences with a “bug” in them. They will swap with a group member to see if the other person can find and fix the bug.
Instructions:
“Now that you’ve helped fix some bugs, it’s time to make your own! Write a code that has a little mistake in it, and then give it to a group member to find the bug!”
- Guide students in creating simple sequences with intentional mistakes, such as:
- A wrong turn
- Incorrect movement steps
- Showing the wrong text
- Ask them to write create the simple sequence with the error and tell their group member what they wanted the robot to do.
Teacher’s Role:
- Encourage creativity and collaboration as students create their buggy codes and share them with their group member to debug.
5. Reflection and Wrap-Up (5 minutes)
Activity:
Gather students together and reflect on the importance of fixing bugs in coding.
Reflection Questions:
- “What was the most fun part about finding bugs today?”
- “Did you find it hard or easy to spot the mistakes?”
- “Why do you think it’s important to fix mistakes in coding?”
Teacher’s Role:
- Summarize the lesson by reinforcing the idea that debugging is part of making robots work correctly and can be fun when we find and fix the mistakes.
- Celebrate the students’ efforts in helping their robots follow the right instructions!
Learning Outcome:
By the end of the session, students will understand the concept of debugging as finding and fixing mistakes in their code. They’ll be able to spot simple bugs and correct them using movement and text blocks in Scratch.

