Teacher Resources: Python with Robots MS - Mission 3-1
Time and Motion Lesson 1: Timing and Sequencing
Students will control CodeBot LEDs with specific timing and sequencing using variables and the sleep function.
Overview
Mission 3-1 introduces students to timing and sequencing in Python. Students learn to import specific functions from a library, use the sleep function to control timing, and define variables to make their code more efficient. They also get hands-on experience with the CodeSpace debugger's Step feature to see how Python executes code one line at a time.
🎯 Mission Goal: Students will create a light show on CodeBot by sequencing LEDs with precise timing using variables and the sleep function.
Learning Targets
- I can import a specific built-in function from a library.
- I can use the "Step" feature of the CodeSpace debugger.
- I can use a variable to make code more efficient.
- I can assign a value to a variable.
- I can use a variable as an argument in a function call.
Key Concepts
- Computers execute code in sequential steps.
- The CodeSpace debugger lets you step through code one line at a time to understand what the computer is doing.
-
Built-in functions come from libraries, like
botcoreortime. - A function call can pass a value, or argument, to the function.
- Variables can be defined to hold changing values, making code more efficient and reducing duplication.
Assessment Opportunities
- Mission 3 Lesson 1 Log assignment
- Submit completed program SequenceLEDs
- Submit the program with extensions
- Mission 3 Obj. 1-5 Review Kahoot!
Success Criteria
- Light up four user LEDs in sequence
- Use the "Step In" feature of the CodeSpace debugger
- Import the sleep function
- Use the sleep function to slow down code
- Define a variable
- Use a variable in a function call
- Create a light show with CodeBot's LEDs
Digital Resources
Classroom Materials
- ▸CodeBot
- ▸USB cable
Real-World Applications
Extensions & Cross-Curricular
🔤
Vocabulary
▾
1 or "hello" or True.
🐍
New Python Code
▾
sleep() - will sleep the amount of time in seconds
sleep()
📐
Standards
▾
CSTA Standards — Grades 6–8
- 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 they will answer. Prepare the assignment to give through your LMS.
- If you have a word wall, or another form of vocabulary presentation, prepare the new terms.
- Although you cannot copy and paste from CodeTrek, you can copy and paste in the text editor. The program for this lesson has a lot of repetition. Show students editor shortcuts, as needed, to save time.
- This lesson is a good time to discuss common programming practices, such as descriptive variable names and blank lines.
- The extensions for this lesson give students an opportunity to be creative and express themselves through a light show. If you have time for students to do an extension, it is motivational and engaging.
Lesson Outline
Slide 2 - Students can write in their log first and then share, or discuss first and then write in their log.
- Question: What code turns on a user LED?
- Question: What code turns off a user LED?
- Students can share their answers, or compare with each other. This code is used during the lesson.
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.
🗝️ Optional: Mission 3 Obj 1-5 Kahoot! Review. A review Kahoot! is available for these five objectives. You can do the Kahoot together as a class, or assign it independently. (link above)
The post-mission reflection asks students to think critically about programming and reflect on what they are learning. You can use an extension or cross-curricular activity as post-mission activity.
End by collecting the Mission 3 Lesson 1 Log.