← Free Lesson Plans for Teachers Free Lesson Plan Grade 2Engineering & Coding45 minFinch1A-AP-141A-AP-11 ⬇ Download PDF (lesson, student sheets & answer key) Driving question: When a program does not work, how do we find and fix the problem? Students get a robot, a floor maze, and programs that are almost right. Each program has one "bug." Students predict what the robot will do, run the program, find the step where the robot went wrong, and fix it. They learn a simple debugging routine they can use any time: predict, run, find the first wrong step, change one thing, test again. CSTA codes are from the 2017 CSTA K-12 Computer Science Standards and show which standards this lesson practices. This lesson has not been reviewed or endorsed by CSTA. CSTA released revised PK-12 standards in 2026. Students will: Geyer resources for this lesson Exit ticket: Show: "forward, forward, turn right, forward" when the robot needed to turn left. Ask: "Which block is the bug? How would you fix it?" Use these sheets in class, or download the PDF for a print-ready layout. Student Sheet 1 Print-ready version in the PDF. Name: ______________________________ Date: ______________ The robot starts in the bottom-left square, facing up. Each square is 1 move. The goal is to reach Home. Each program below has ONE bug. Student Sheet 2 Print-ready version in the PDF. Name: ______________________________ Date: ______________ Why should we change only one block at a time? Tape a 6-by-4 grid of squares that each match one move. Wall 1 runs from the top edge down 2 squares between columns 2 and 3; wall 2 runs from the bottom edge up 2 squares between columns 4 and 5. Robots may need a little extra turn amount on carpet; adjust once and keep it the same for all groups. Need a print-ready copy? The PDF includes the lesson, student sheets, and answer key. Free for classroom use. You may print and copy this lesson for your students. © Geyer Instructional Products. Standards text: CSTA K-12 CS Standards © CSTA.Overview
Standards
Code Standard CSTA 1A-AP-14 (2017) finding and fixing program errors CSTA 1A-AP-11 (2017) breaking a job into steps Learning Objectives
Materials
One robot per group of 2-3 students.
Floor mat with a centimeter grid and number line for robot math.
Classroom set option so every small group has a robot.Also needed
Vocabulary
Word What it means bug A mistake in a program. debug Find and fix a mistake in a program. predict Say what will happen before it happens. test Run a program to see if it works. Safety Notes
Before You Teach
Warm-Up (5 min)
Procedure
Model the routine (8 min)
Bug hunt (20 min)
Make a bug (7 min)
Reflect (5 min)
Differentiation
Support On-level Challenge • Do Bug 1 together, then Bug 2 with a partner.
• Use arrow cards on the floor next to the maze to act out each step.
• Highlight the turn blocks in a different color.• Complete the procedure and student sheets as written. • Find a shorter correct path.
• Debug a program with two bugs.
• Write the routine in your own words for a kindergarten buddy.Assessment
Criterion Beginning Developing Proficient Predicts No prediction Partial prediction Clear prediction before each run Finds the bug Guesses Finds it with help Finds the first wrong step Fixes and retests Changes many things Fixes after several tries Changes one thing and retests Extensions
Student Sheets
The Maze and the Buggy Programs
Program Steps Bug 1 forward 1, turn right, forward 3, turn right, forward 2, turn right, forward 2 Bug 2 forward 2, turn right, forward 3, turn left, forward 2, turn right, forward 2 Bug 3 forward 1, turn right, forward 3, turn left, forward 2, turn right, forward 1 My Bug Report
Bug I predicted... The robot went wrong at... My fix 1 2 3 Show answer key (for teachers)
Answer Key & Teacher Notes
Teacher notes
