Fly with Python - Mission 3: Pre-Flight Check
Pre-Flight Check
Students program CodeAIR's lighting and sound systems, using loops, delays, and pixel LEDs to run a full pre-flight check sequence.
Overview
Mission 3 takes students deeper into CodeAIR programming as they learn to control the pixel LED lighting system and speaker. Students use loops and delays to animate lights and compose sound sequences, culminating in a full pre-flight lighting check using the international Aircraft Position Lighting standard. This mission introduces fundamental programming concepts, including loops, constants, and iteration, through hands-on drone code.
🎯 Mission Goal: Students will learn how to conduct a pre-flight check of CodeAIR by programming its lighting system and speaker.
Learning Targets
- I can control CodeAIR's lighting system.
- I can program the speaker to add sounds.
- I can program the onboard lighting system to show the colors of the international Aircraft Position Lighting scheme.
Key Concepts
-
To slow down computer code, which runs very quickly, you need a delay. In Python, use a
sleep()function to slow down the action. - You can use editor shortcuts to copy and paste code.
-
A loop, like the
while True:statement orforloop, repeats a block of indented code. - CodeAIR has a speaker that produces beeps in different frequencies and durations.
- CodeAIR has 8 pixel LEDs that can light up any color. They are numbered 0-7.
Assessment Opportunities
- Quiz after Objective 2
- Quiz after Objective 4
- Quiz after Objective 7
- Complete the program CycleLEDs
- Complete the program Melody
- Complete the program SkyLights
- Complete the program RunningLights
- Mission 3 Assignment
- Mission 3 Review Questions
Success Criteria
- Use a loop to repeat a block of indented code
- Use the speaker to play music
- Control the pixel LEDs
- RunningLights works correctly and runs without errors
- Complete Mission 3 Assignment
Digital Resources
Classroom Materials
- ▸Laptop/computer with Chrome browser
- ▸CodeAIR, battery and USB cable for each student or programming pair
- ▸Adaptor for USB cable, if needed
Real-World Applications
Extensions & Cross-Curricular
🔤
Vocabulary
▾
seq = range(5) will iterate over 0, 1, 2, 3, and 4.
🐍
New Python Code
▾
sleep.
speaker.beep(440, 200) plays at 440 Hz for 200 ms.
colors module.
pixels.set(0, RED) sets pixel 0 to red.
📐
Standards
▾
CSTA Standards: Grades 6-8
CSTA Standards: Grades 9-10
CSTA Standards: Grades 11-12
- Ensure all CodeAIR drones are charged before class. This mission is 60-90 minutes and will require sustained use.
- Verify USB cables and any necessary adaptors are available for each student or programming pair.
- Consider budgeting time for multiple short check-ins during the longer coding session, as there are several programs to complete.
- The assignment document follows the mission and is a place for guided notes. You can print the document for students or assign it digitally through your LMS.
- Review questions can be used as a class review, made into a Kahoot!, or used to create an exam in your learning management system.
- Extensions and cross-curricular projects are included to enhance the concepts in the mission. A remix is not explicitly planned, but you can add one as an option. A remix is in the pacing after Mission 3.
Lesson Outline
Students access prior knowledge by answering questions in the pre-mission section of the assignment doc.
Connect the mission concept to real aviation safety through a brief discussion.
- Ask: "Why do you think pilots go through a checklist before every flight, even if they've flown the same plane hundreds of times?"
- Ask: "What do the colored lights on an airplane or drone tell other pilots?"
Front-load the key new programming concepts before students begin the longer coding session.
- Demonstrate
sleep(): show how code runs instantly without it, then how a delay changes behavior. - Introduce the
while True:loop: explain infinite loops and why indentation matters. - Preview pixel LEDs and RGB color, briefly showing how colors mix from red, green, and blue values.
Students work through four programs, building complexity with each one. As they work through the objectives, they should take notes and answer questions in their assignment doc.
-
CycleLEDs: use
sleep()and loops to cycle through the blue indicator LEDs (quiz after Objective 2). -
Melody: use
speaker.beep()and constants to play a musical sequence (quiz after Objective 4). - SkyLights: use pixel LEDs and RGB colors with for loops to create color patterns (quiz after Objective 7).
- RunningLights: combine all skills to program the Aircraft Position Lighting scheme (green starboard, red port, white tail).
Bring the class together to share RunningLights results and consolidate the big programming ideas from this mission.
- Ask volunteers who did an extension to share their program.
- Ask: "What is the difference between a
while True:loop and aforloop? When would you use each?" - Ask: "Why is
pixels.fill()a better choice than setting 8 pixels individually?" Connect to abstraction.
Students answer the reflection question in the assignment doc and then submit.
Use the Mission 3 Review Questions through a preferred method: class discussion, Kahoot!, or LMS quiz.