Python Level-1 with Virtual Robotics - Mission 4: Getting Moving

Mission 4 Lesson Plan

Get Moving

Enable CodeBot's motors and apply power to the wheels to spin, curve, and tag objects, then add sound with the speaker.

⏰ 1 hour 🎯 Grades 9-12+ 💻 CodeSpace 🤖 Virtual CodeBot 🐍 Python
View Lesson Outline
📋

Overview

Mission 4 puts CodeBot's motors to work. Students enable the motors, then apply power to each wheel to spin CodeBot in place, sweep it through a curve, and steer it to tag tennis balls. The mission wraps up by introducing CodeBot's speaker, where students play tones to add sound to their programs.

🎯 Mission Goal: Students will move CodeBot by enabling and giving power to the wheels.

🎯

Learning Targets

  • I can apply power to the wheels to spin the CodeBot.
  • I can apply power to the wheels to move the CodeBot in a curve (or circle).
  • I can control the movement of CodeBot to tag objects.
  • I can play tones on CodeBot's speaker.
💡

Key Concepts

  • Motors must be enabled before they can receive power.
  • Wheel power ranges from -100 percent (reverse) to +100 percent (forward) speeds.
  • If equal but opposite speeds are applied to the wheels, the 'bot will spin.
  • If positive but different speeds are applied to the wheels, the 'bot will move in a circle.
  • Use the sleep() function to keep the motors running.
  • The speaker can play a tone for a specified amount of time.
✅

Assessment Opportunities

  • Quiz after Objective 3
  • Submit program code, or give students printed code and have them explain each line: Objective 1, Objective 2, Objective 3, Objective 4
  • Code Tracing Chart as a debugging tool
  • Quiz or exit ticket with code. Have students explain the direction the 'bot will move.
  • Objective 3 Planning Guide
  • Submit final program code for robot tag
  • Submit Obj. 4 code for "Sound Off"
  • Level-1 Mission 4 Review Kahoot!
☑️

Success Criteria

  • Use wheel power to spin CodeBot
  • Use wheel power to move CodeBot in a circle
  • Use wheel power to move CodeBot so it tags tennis balls
  • Play at least two notes from the speaker
🌍

Real-World Applications

Using motors, lights, and sounds in a timed sequence is animation. Using code to run the animation makes it automation - and many items and objects in the real world rely on it.

🎡Amusement park rides use timed motor sequences to create thrilling, precisely choreographed experiences.
🚗Cars use automated systems, like turn signals and cruise control, that run motors and lights without constant driver input.
🧹Automatic vacuums combine motors and sensors to navigate and clean a room on their own.
🚀

Extensions & Cross-Curricular

ExtensionFor Objective 3, tag all four tennis balls.
ExtensionPlay a short song, like a nursery rhyme, using the speaker.
Lang ArtsHave students write a short review about an animation or automation.
Performing ArtsLearn about music and note notation.
🔤

Vocabulary

▾
Enable - Turning on a hardware system, like the motors, so it's ready to receive commands.
Wheel power - The speed sent to a wheel, from -100 percent (full reverse) to +100 percent (full forward).
Spin - Turning in place by sending equal but opposite power to both wheels.
Curve - Moving in an arc by sending different, same-direction power to each wheel.
Tone - A single musical pitch played through CodeBot's speaker.
Pitch - How high or low a tone sounds, set as a frequency.
🐍

New Python Code

▾
motors.enable(True) Enable CodeBot's motors.
motors.run(LEFT, 30) motors.run(RIGHT, -30) Apply power on the wheels to spin. Positive left, negative right spins clockwise; negative left, positive right spins counter clockwise.
motors.run(LEFT, 50) motors.run(RIGHT, 40) Sweeping circle (or curve) in a clockwise direction.
spkr.pitch(440) sleep(0.1) Play a tone on the speaker for a specific amount of time.
spkr.off() Turn off the tone.
📐

Standards

▾

CSTA Standards - Grades 9-10

3A-CS-03 3A-AP-16 3A-AP-19 3A-AP-21 3-AP-22 3-AP-23

CSTA Standards - Grades 11-12

3B-CS-02 3B-AP-17 3B-AP-22

Certiport IT Specialist: Python Standards

4.1

PCEP: Certified Entry-Level Python Programmer

Section 1.1 Section 1.2 Section 4.2
📝
Preparing for the Lesson
  • It isn't explicitly mentioned, but students should start a new file for this program code. File names should be descriptive - if students are submitting the file, have them include their name in the filename.
  • Have the Level-1 Mission 4 Assignment and Assignment Answers ready to hand out or post in your LMS for quick grading.
  • Print or share the Obj. 3 Planning Guide before students reach the robot tag objective - it's highly recommended for planning their code.
  • Have the Code Tracing Chart on hand as a debugging tool students can use throughout the mission, not just for Objective 3.
  • Pull up the Mission 4 Review Questions and have the Review Kahoot! link ready to launch for a class-wide review.
  • Keep the Code Solutions in your Teacher Dashboard on hand as a reference if students get stuck or you want to compare approaches.

🧑‍🏫
Teacher Notes
  • Students can use the same file during the mission. For the final objective, they can use a new file, or they can just add the speaker code to the top of the current file.
  • Students may want to zoom out or change the camera view when running the code to see the 'bot move.
  • Give students time to experiment with different speeds. No need to rush through the objectives.
  • Give students time to experiment with different tones. No need to rush through the objectives.
  • Do a code tracing chart together. Talk about what works and what doesn't. Emphasize the importance of documenting your tries to help with debugging in the future.
🗺️

Lesson Outline

🗣️Warm-up / Hook

Have students write or discuss their answers before revealing them.

  • Question: If you wanted CodeBot to spin in place using its two wheels, what would each wheel need to do?
  • Question: Where have you seen animation or automation used in your everyday life?
Teaching tip: Have two students link arms and walk in opposite step patterns to physically demonstrate a spin before coding it.
💻Objectives 1-2: Spin & Curve

Students open CodeSpace, start a new file, and begin the Level-1 Mission 4 Assignment.

Teaching tip: Start with motors.enable(True), then spin CodeBot with equal but opposite wheel speeds, like motors.run(LEFT, 30) and motors.run(RIGHT, -30). Reverse the signs to change spin direction.
Teaching tip: Move into curves by giving both wheels positive but different speeds, like motors.run(LEFT, 50) and motors.run(RIGHT, 40) - the bigger the difference, the tighter the turn.

Have students submit their code, or hand them printed code to explain each line, for Objectives 1 and 2.

🎯Objective 3: Robot Tag

Before students start coding, have them use the Obj. 3 Planning Guide to plan how they'll drive CodeBot to tag all four tennis balls.

Teaching tip: Have students use the Code Tracing Chart as they test their plan - documenting what works and what doesn't builds a debugging habit they'll use all year.

Give the quiz once students can spin and curve CodeBot reliably. Have students submit their final program code for robot tag.

🔊Objective 4: Sound Off
Teaching tip: spkr.pitch(440) paired with sleep(0.1) plays a tone for a set time, and spkr.off() turns it off. Challenge students to play at least two notes.

Students can add the speaker code to the top of their existing file or start a new one. Have them submit their "Sound Off" code.

If students finish early or need extra support at any point in the mission, point them to the Level-1 Mission 4 Assignment Answers, or to the Code Solutions in your Teacher Dashboard for reference.

🧑‍🤝‍🧑Post-Mission Reflection

Give a quiz or exit ticket with code and have students explain the direction CodeBot will move.

Have students work through the Level-1 Mission 4 Review Questions individually or in pairs.

Wrap up with the Level-1 Mission 4 Review Kahoot! Keep the Code Solutions in your Teacher Dashboard on hand if you want to compare approaches during the debrief.