Haunted Code Chronicles - Mission 4: The Hallway
The Hallway
Students will use line sensor readings to follow a dark line on the floor to reach a doorway.
Overview
Mission 4 is a short, focused mission in the dark hallway. Students read a single line sensor and print its value to the console, then pick a threshold and use it in an if statement to stop the 'bot on a stain. From there they read all five sensors at once, work with the tuple that comes back, and build a bang bang controller that follows a dark trail all the way to the door.
π― Mission Goal: Students will use line sensor readings to follow a dark line on the floor to reach a doorway.
Learning Targets
- I can read the line sensors and return their values.
- I can print a value to the console.
- I can use a line sensor reading in a condition to control CodeBot.
Key Concepts
- CodeBot has five line sensors. Each one returns a reading of light reflectivity.
- All five sensors can be read at the same time and compared to a threshold. A tuple of five Booleans is returned.
- A tuple is a read-only version of a list. You can use the values but not change them.
Assessment Opportunities
- Complete the Mission 4 Activity Guide.
- Complete and turn in program HallwayStains after Objective 4.
- Record the score for the mission, found in the class dashboard.
- Write a paragraph about their coding experience and what they learned.
Success Criteria
- Read a single line sensor and print the value to the Console
- Determine a threshold value for line sensor readings
- Use a line sensor reading and threshold in an if statement
- Read all five line sensors at the same time and return a tuple of five Booleans
- Use the algorithm for a bang bang controller to guide CodeBot along a dark line to the door
Digital Resources
Classroom Materials
- βΈLaptop/computer with Chrome browser
π€
Vocabulary
βΎ
π
New Python Code
βΎ
π
Standards
βΎ
CSTA Standards - Grades 3-5
CSTA Standards - Grades 6-8
CSTA Standards - Grades 9-10
CSTA Standards - Grades 11-12
- Go through the Mission in advance, if you can. This is a fairly short mission.
- The mission has two activity guides. They use the same questions, but the alternative guide (alt) gives added support with the questions. Use the one that best fits the needs of your students.
- Students will do all their coding in one program. The code from the first three objectives will be deleted and replaced with code copied from the instructions for Objective 4. If students want to keep their code from Objectives 1-3, they need to either start a new file for Objective 4 or do a "Save As".
- Subtle changes are made in their code during Objectives 1-3. Students need to pay attention to CodeTrek to avoid syntax and typing errors.
Lesson Outline
The warm-up has two questions. Have students share their answers as a class discussion or think-pair-share. Objective 1 gives a quick lesson on line sensors. Look it over to see if you need to do any additional front-loading or if the instructions are enough for your students to continue.
Go over the mission introduction to help them understand what will be expected during this mission.
# TODO:. Students should open the Console and observe the readings. The goal should be met with one try. If for some reason the goal isn't met and the 'bot goes past the red stain, just have the student do a reset and run again.- Beginning students do not need to read the hints. The copied code and CodeTrek, with slight modifications, will complete the challenge.
- There are two different configurations for the hallway stain. One scene uses the door on the left, and the other uses the door on the right. Both configurations have a short path and a long path, and the same code should work on both scenes.
- Students will do a lot of trial and error, which means resetting the scene multiple times. Sometimes the 'bot will be positioned in front of the longer trail. Students can try the longer trail, or do another reset to position the 'bot in front of the shorter trail.
- The easiest modification to make is to try a slower speed. Experiment with the speed until you find one that keeps the 'bot on the trail.
- Students who want to try the challenges can read the hints and add more elif statements for more precise turning, and also try the longer trail.
The reflection questions can be written, shared as a class discussion, or handled through a think-pair-share activity. This is an opportunity to promote a growth mindset.