Mission 6-1: Line Follower Lesson 1 | Python with Robots MS
Line Follower Lesson 1: Detecting Lines with Sensors
Students will detect lines using line sensors and display the data on LEDs using a Boolean list.
Overview
Mission 6-1 introduces students to Python lists and how they can be used to store and work with collections of sensor data. Students learn how to define a list, access items by index, update list items using line sensor readings, and use REPL to test code interactively. The mission builds directly on Mission 5, using familiar sensor code as a foundation for learning list concepts.
🎯 Mission Goal: Students will detect lines using line sensors and display the data on LEDs using a Boolean list.
Learning Targets
- I can define a list and access its items.
- I can update items in a list using sensor data.
- I can use REPL to gather real-time data from sensors.
- I can use a list of Boolean values to turn on/off LEDs.
Key Concepts
- There is no "hidden magic" going on here! The 'bot responds to programmed inputs and outputs.
- The line follower 'bot will need to continuously check for the presence of a line beneath all five sensors.
- The debug window in the console panel can display current values of variables. The console window can be used to test code.
Assessment Opportunities
- Mission 6 Lesson 1 Log (digital)
- Quiz after Objective 2
- Submit completed program CheckLines
- Mission 6 Obj. 1-3 Review Kahoot!
Success Criteria
- Define a list with five Boolean values
- Define a function that returns a list of bools
- Update items in the list using sensor data
- Observe list values in the debug window
- Test a line of code in REPL (console window)
- Use a list of bools to turn on/off LEDs
Digital Resources
- ▸Mission 6 Lesson 1 Slides
- ▸Mission 6 Lesson 1 Log
- ▸Mission 6 Lesson 1 Answer Key
- ▸Mission 6 Obj. 1-3 Review Kahoot!
- ▸CheckLines_obj3 sample code
- ▸CodeBot Test Surfaces
Classroom Materials
- ▸CodeBot
- ▸USB cable
- ▸White paper with a black line made from electrical tape
Real-World Applications
Extensions & Cross-Curricular
🔤
Vocabulary
▾
🐍
New Python Code
▾
n in a list.
📐
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 students will answer. Prepare the assignment to give through your LMS.
- Have the Test Surfaces paper available for each student or programming pair. They will also want a small black paper to act as a line - a piece of black electrical tape on a piece of white paper works well.
- If you have a word wall, or another form of vocabulary presentation, prepare the new terms.
- The examples given in the slides are more in line with variables and examples from Mission 5.
- The code used in the slides is similar to CodeTrek, but a little different. It uses code and variable names from the program in Mission 5. All goals will be met.
- Slides go into a lot more detail about lists, giving more examples and practice.
- It is not recommended to use the quiz after Obj. 2. Since the examples and program code are slightly different, the quiz questions aren't applicable if you are using the slides instead of the instructions.
Lesson Outline
Slide 2 - Students can write in their log first and then share, or discuss first and then write in their log. The warm-up questions review code from Mission 5.
- Question: How do you read a line sensor?
- Question: What surface colors have the highest readings?
- Question: What code assigns a Boolean value from a reading?
Students can share their answers, or compare with each other.
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.
detected, is_detected, n, and thresh variables.leds.ls(0b00110) goes from LED 4 down to LED 0, while leds.ls([False, True, True, False, False]) goes from LED 0 up to LED 4. Students can practice conversions with a chart in the mission log. The last row on the chart is for students to make up their own LED example.🗝 Optional: Mission 6 Obj 1-3 Kahoot! Review - a review Kahoot! is available for these three objectives.
The post-mission reflection asks students to review code for working with lists, and to think about general uses for lists in a program.
You can use an extension or cross-curricular activity as a post-mission activity.
End by collecting the Mission 6 Lesson 1 Log.