Fly with Python - Mission 2: Introducing CodeAIR

Mission 2: Introducing CodeAIR | Fly with Python
Mission 2 Lesson Plan

Introducing CodeAIR

Students meet the CodeAIR drone, identifying key components, connecting to CodeSpace, and writing their first Python program to control the LEDs.

⏱ 30-40 min 🎯 Grades 6-12+ 💻 CodeSpace 🚁 CodeAIR 🐍 Python
View Lesson Outline
📋

Overview

Mission 2 introduces students to the CodeAIR drone itself. Students learn safety features, identify key components like the power switch and LEDs, and connect the drone to CodeSpace. They are introduced to CodeTrek and Hints, then write and run their first drone program to turn on LEDs. This is where hands-on coding begins.

🎯 Mission Goal: Students will learn about the CodeAIR drone and its LED lights, identifying hardware components, connecting to CodeSpace, and writing their first Python program to control LEDs.

🎯

Learning Targets

  • I can identify the parts of CodeAIR.
  • I can connect CodeAIR to CodeSpace.
  • I can create and save a file in CodeSpace.
  • I can control LEDs on CodeAIR with code.
💡

Key Concepts

  • The battery is charging anytime CodeAIR is plugged in.
  • CodeAIR must be turned on to connect to CodeSpace and run code. The switch is tiny!
  • Code typed into the text editor is automatically saved to your personal file-system.
  • CodeTrek is like your own personal tutor, guiding you through programming challenges.
  • Python code is case sensitive. Punctuation is important! That is the first thing to check if an error occurs in code.

Assessment Opportunities

  • Quiz after Objective 2
  • Quiz after Objective 8
  • Complete the program Lights1
  • Mission 2 Assignment
  • Mission 2 Review Questions
☑️

Success Criteria

  • Identify key parts of CodeAIR
  • Connect CodeAIR to CodeSpace
  • Create a program file with code
  • Lights1 works correctly and runs without errors
  • Complete Mission 2 Assignment
🧰

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

🚁Commercial drones use programmable LED systems for navigation lights, status indicators, and visibility during flight operations.
🔌Understanding hardware peripherals and how software communicates with them is foundational to embedded systems engineering and IoT development.
Static electricity awareness is critical in electronics manufacturing; professionals use grounding straps and ESD-safe workstations to protect components.
🚀

Extensions & Cross-Curricular

ExtensionUse the LEDs to display a pattern by either turning some lights on and keeping some off, or using different levels of brightness.
ExtensionDiscuss abstraction and how it is used in the hardware of CodeAIR.
ScienceCodeAIR has several LEDs. Research what an LED is and how it works.
Lang ArtsWrite a technical document that explains the parts of CodeAIR and their functions.
🔤

Vocabulary

CodeAIR - A high performance micro-drone that's fully programmable in Python.
LEDs - Light emitting diodes; tiny and efficient electronic components that produce light. CodeAIR has 8 blue indicator LEDs, numbered 0 through 7.
Buttons - Momentary push buttons on CodeAIR that you can program. The user interface push buttons are B0 and B1.
Motors - Brushed DC motors that are electric and power the propellers to lift CodeAIR into the air and maneuver it around.
Static Electricity - A charge that builds and can cause a jolt and spark that happens when grounded.
CPU - Central Processing Unit; the brain of the computer. It interacts with all the peripherals.
Peripheral - Devices that give input or output. CodeAIR's peripherals include LED lights, speaker, motors, sensors and pushbuttons.
Code - Instructions to the computer.
Comment - Code that doesn't get run; notes in the code about what you are doing.
Module - Also known as a library; it contains pre-loaded code, like functions and methods, that can be used once the module is imported.
🐍

New Python Code

from codeair import *Import the codeair library - all built-in code specific to CodeAIR.
leds.set(num, brightness)Sets the user LED at a brightness level. For example, leds.set(0, 50) sets LED 0 to 50 percent brightness.
📐

Standards

CSTA Standards - Grades 6-8

2-CS-02 2-CS-03 2-AP-16 2-AP-19

CSTA Standards - Grades 9-10

3A-CS-01

CSTA Standards - Grades 11-12

3B-CS-02
📝
Preparing for the Lesson
  • Ensure all CodeAIR drones are charged before class, as the battery charges whenever CodeAIR is plugged in via USB.
  • Verify USB cables and any necessary adaptors are available for each student or programming pair.
  • Review the CodeAIR Flying Guide so you can help students troubleshoot connection issues quickly.

🧑‍🏫
Teacher Notes
  • The assignment document follows the mission and is a place for guided notes. You can print the document for students (PDF) or assign it digitally through your LMS.
  • To run the drone, the CodeAIR must be connected and turned on, even if it is not flying. Also, you must be working in an objective that doesn't show the 3D simulated environment.
  • 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

🗣️Warm-up / Hook

Students answer two questions in the assignment. They can do a think-pair-share.

Open with a brief discussion to connect prior coding knowledge to physical hardware.

  • Ask: "What do you already know about how drones work?"
  • Ask: "How do you think a computer program tells a light to turn on?"
Teaching tip: Hold up the CodeAIR drone and point out the LEDs, power switch, and USB port before students start. A 60-second physical tour sets the stage well.
📖Introduce the Mission

Walk students through handling and connecting CodeAIR before they begin the CodeTrek objectives.

  • Demonstrate how to safely handle CodeAIR: avoid touching propellers and be aware of static electricity.
  • Show students the power switch, which is very small and easy to miss.
  • Demonstrate connecting CodeAIR to CodeSpace and creating a new program file.
Teaching tip: Emphasize that CodeAIR must be turned ON to connect, the most common stumbling block in this mission.
Teaching tip: The assignment doc mirrors the mission content and works well as a print or digital handout.
💻Coding Time

Students work through CodeTrek objectives to connect CodeAIR and write their first LED program. As they work through the objectives, they should take notes and answer questions in their assignment doc.

  1. Students connect CodeAIR, turn it on, and verify the connection in CodeSpace.
  2. Students complete early objectives introducing hardware components (quiz after Objective 2).
  3. Students create a new program file and write their first lines of Python using from codeair import *.
  4. Students use leds.set() to control individual LEDs and complete the Lights1 program (quiz after Objective 8).
  5. Students run Lights1 and verify it works correctly without errors.
Teaching tip: Python is case-sensitive. Coach students to check capitalization and punctuation first whenever they get an error.
Teaching tip: Early finishers can try the LED pattern extension, turning some lights on and others off, or experimenting with different brightness levels.
🧑‍🤝‍🧑Class Debrief

Bring the class together to share their Lights1 programs and discuss what they discovered about hardware and software.

  • Ask volunteers who did an extension to share their program.
  • Ask: "What parts of CodeAIR did you identify today?"
  • Ask: "What does from codeair import * actually do - why do we need it?"
  • Connect to real world: "Where else do you see programmable LEDs being used?"
Teaching tip: Highlight the concept of a module/library. This pattern of importing pre-built code will appear in every future mission.
✏️Wrap-up & Review

Students answer the reflection question in the assignment doc and then submit.

Use the Mission 2 Review Questions through a preferred method: class discussion, Kahoot!, or LMS quiz.