Teacher Resources: Python with Robots MS Mission 4-4
Animatronics Lesson 4: The Complete Project
Students play a fanfare using constants, then combine three previous programs into one complete Animatronics project.
Overview
Mission 4-4 is the capstone lesson of the Animatronics unit. Students learn to define and use constants - variables with ALL CAPS names that hold values that don't change during program execution. They use constants to represent musical notes and call the note() function multiple times to play a fanfare. Then, using CodeSpace's multi-program text editor, they combine code segments from their three previous lessons into one complete, working Animatronics project.
🎯 Mission Goal: Students will build a complete Animatronics program that combines LED sweeping, robot movement with sounds, and a fanfare - all triggered from a single napkin sketch design.
Learning Targets
- I can define a constant.
- I can use a constant as an argument in a function call.
- I can call a function several times, with different arguments.
- I can combine code segments from one program with code from another program.
Key Concepts
- Python doesn't have a specific designation for a constant - it is just another variable. But you can visually distinguish a constant from a variable by using ALL CAPS for its name. This can help you remember not to update the value during the program execution.
- CodeSpace allows for several programs to be open at the same time. Using the text editor, it is easy to add code from one program into another program using copy/paste.
Assessment Opportunities
- Mission 4 Lesson 4 Log (digital)
- Submit completed program Animatronics
- Submit the program with extensions
- Mission 4 Obj. 12 Review Kahoot!
Success Criteria
- Define a constant
- Use a constant as an argument in a function call
-
Call the
note()function multiple times to play a song - Combine parts of three programs into one complete project that accomplishes all the tasks on the napkin sketch
Digital Resources
Classroom Materials
- ▸CodeBot
- ▸USB cable
- ▸4 AA batteries
- ▸Optional: measuring stick
Real-World Applications
Extensions & Cross-Curricular
note() function.
🔤
Vocabulary
▾
🐍
New Python Code
▾
📐
Standards
▾
CSTA K-12 CS Standards
- Decide what materials you want to use for presenting the lesson. The slides can be projected on a large screen.
- Be familiar with the mission log assignment and the questions students will answer. Prepare the assignment to give through your LMS. There aren't many questions for this assignment - most of the work is done in CodeSpace.
- If you have a word wall or another form of vocabulary presentation, prepare the new term: Constant.
- RECOMMENDATION: Use the slides instead of instructions in CodeSpace and CodeTrek. This is the final lesson that combines the previous programs into one complete project. The final code works the same but is in a different order from CodeTrek. Use the slides or CodeTrek, but not both.
- Students will not start a new program for this lesson. They start with the last program (RobotMoves) and save it with a new name.
Lesson Outline
Students can write in their log first and then share, or discuss first and then write. These warm-up questions review code from Mission 4 Lesson 1.
- Question: What lines of code pause the program and wait until a button is pressed?
- Question: How do you define and call a function?
The Chrome browser works best, but other browsers also support CodeSpace. Each student will complete a Mission Log. Students could work in pairs through the lesson, or they can work individually.
- Slides 5-6: Introduce the problem. Students open the program from Lesson 3 and save it with a new name.
- Slides 7-9: Music and notes background. Slide 10: Define a constant - students add constant definitions to their program.
- Slide 11: Show the complete code. Slides 12-13: Call
note()multiple times to complete the fanfare. - Slides 14-15: Move the fanfare code to the end of the program. Students run and verify the program works.
- All mission goals will be met after Objective 12. Students can proceed to Mission 5, but they aren't done - the next slides combine all programs into one complete project. Students can stay in Mission 4 Objective 12 or move to the sandbox.
sleep() function. Students do a little math to figure out how many beeps are needed to give the robot time for spinning - use the chart in the mission log. Students may need to adjust the specific number after testing.A review Kahoot! is available for this lesson - it focuses on the use of constants. Alternatively, you can use the Kahoot reviews from Lessons 1, 2, and 3.
The post-mission reflection asks students to think about the programming process. Each student will likely answer differently - this is a great opportunity for a share-out.
- You can use a cross-curricular activity as the post-mission activity.
- Discuss real-world applications for constants and/or combining parts of things to make a new project.
- End by collecting the Mission 4 Lesson 4 Log.