Mission 4: Get Moving
Get Moving
Enable CodeBot's motors and apply power to the wheels to spin, curve, and tag objects, then add sound with the speaker.
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
Digital Resources
Classroom Materials
- βΈComputer or Chromebook with internet access
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.
Extensions & Cross-Curricular
π€
Vocabulary
βΎ
π
New Python Code
βΎ
π
Standards
βΎ
CSTA Standards - Grades 9-10
CSTA Standards - Grades 11-12
Certiport IT Specialist: Python Standards
PCEP: Certified Entry-Level Python Programmer
- 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 Mission 4 Final Code Solutions on hand as a reference if students get stuck or you want to compare approaches.
- 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
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?
Students open CodeSpace, start a new file, and begin the Level-1 Mission 4 Assignment.
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.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.
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.
Give the quiz once students can spin and curve CodeBot reliably. Have students submit their final program code for robot tag.
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 the Final Code Solutions for reference.
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 Final Code Solutions on hand if you want to compare approaches during the debrief.