Lift-Off with CodeX - Mission 2: Lift-Off!

Mission 2 Lesson Plan

Lift-Off!

Let's go to Mars! Students build a power switch for the engines, a countdown sequence for personnel, and a launch button for Mission Control, all while refreshing their Python skills.

⏱ 45-90 min 🎯 Grades 6-12 💻 CodeSpace 📱 CodeX 🔌 Peripherals Kit 🐍 Python
View Lesson Outline
📋

Overview

Let's go to Mars! This mission is all about getting the rocket ship off the ground. Students create a power switch for the engines, a countdown sequence for personnel, and a launch button for Mission Control.

Two new input peripherals show up here, a switch and a button, and each one controls a different part of the launch. Students read those inputs inside an infinite loop, branch on what they find, and break out of the loop when the launch begins. Ideally students refresh their Python knowledge as they get the mission to Mars underway.

🎯 Mission Goal: Students write code to simulate the launch of a CodeX spacecraft.

🎯

Learning Targets

  • I can describe the difference between a button and a switch.
  • I can read the value of a button and a switch.
  • I can use an infinite loop to continuously check the values of the button and switch.
  • I can use a button and a switch to control an LED.
  • I can break out of a loop.
  • I can display a countdown sequence.
💡

Key Concepts

  • Understand the difference between a button and a switch. The switch locks in place while the button does not.
  • The project uses two input peripherals, a button and a switch. Each one controls a different aspect of the lift-off project.
  • Use three branches in the infinite loop. One branch will have two conditions.

Assessment Opportunities

  • Check for Understanding in CodeSpace (2)
  • Mission 2 Assignment
  • Practice evaluating conditional statements
  • Exit ticket - construct a conditional statement
  • Submit and/or check the LiftOff program
  • Journal entry on their learning experience
☑️

Success Criteria

  • Use a switch to turn the red LED on and off.
  • Use a button to launch a countdown sequence.
  • Show a countdown sequence on the CodeX display that includes a flashing white LED.
🧰

Classroom Materials

  • Laptop/computer with the Chrome browser
  • CodeX and connecting cable
  • Red and white LED peripherals
  • Switch peripheral
  • Button peripheral
Red LED peripheral board for the CodeX, showing the latching cable connector and the G, V, S labels Switch peripheral board for the CodeX, showing the latching cable connector and the G, V, S labels Blue button peripheral board for the CodeX, showing the latching cable connector and the G, V, S labels
🌍

Real-World Applications

🔘Anything with a lever, button, or switch is a real world example. Elevator buttons, doorbells, keyless entry on a car, and the "start engine" button all work the way this mission does. Have students come up with their own examples.
🧩The mission uses a function. Discuss abstraction and how it hides the details of embedded technology from the person using it.
🗒️The mission uses an algorithm. Have students write their own algorithms for daily tasks, for other computer programs, or for how they think an electronic device works.
🚀

Extensions & Cross-Curricular

ChallengeDisplay images of a rocket ship taking off during the lift_off phase.
ChallengeAdd the CodeX pixels as flashing lights during the countdown phase. Use random colors.
ChallengeEach astronaut may need to indicate they are ready for lift-off. Use the CodeX buttons as inputs for the astronauts to push in sequence to show they are ready.
Lang ArtsStudents write about a time they prepared to leave for somewhere, or discuss the theme of transition in a current book assignment.
ScienceDiscuss gravity or Newton's Laws and how they relate to the mission to Mars, or include a lesson on space.
MathCreate a chart of the distance traveled by the ship, or draw a rocket ship trajectory and find the equation of the line.
🔤

Vocabulary

Abstraction - Organizing an algorithm into sub-tasks, or functions, where the details can be hidden.
Algorithm - A sequence of steps for completing a task, a step by step process.
Branching - Decision points in code, a condition the program checks before choosing what to do next.
🐍

New Python Code

exp.digital_in(exp.PORT0)Used to set up a digital input peripheral, such as a button or a switch.
button.valueReturns the button's position: True (not pressed) or False (pressed).
switch.valueReturns the switch's position: True (out) or False (in).
display.fill()Fills the CodeX LCD screen with a pre-defined or RGB color.
📐

Standards

CSTA Standards - Grades 6-8

2-CS-03 2-AP-10 2-AP-11 2-AP-12 2-AP-13 2-AP-14

CSTA Standards - Grades 9-10

3A-CS-02 3A-AP-13 3A-AP-15 3A-AP-16 3A-AP-17 3A-AP-18

CSTA Standards - Grades 11-12

3B-CS-02 3B-AP-10 3B-AP-14 3B-AP-16
📝
Preparing for the Lesson
  • Students need a computer or laptop with the Chrome web browser.
  • Make sure students can successfully log in to make.firialabs.com.
  • Sort the switch, button, and white LED peripherals ahead of time so each group can grab a set quickly.
  • Build the launch sequence yourself once before class so you can demonstrate the switch, the countdown, and the launch button confidently.

🧑‍🏫
Teacher Notes
  • Remind students to be gentle as they connect and disconnect the peripherals from the CodeX. You can work with students in small groups as they practice.
  • This project gives students plenty of opportunities to engage in the computational thinking skill of abstraction. Encourage students to carefully read about abstraction in Objective 5, and keep reminding them that when they create functions, they are practicing abstraction.
  • The concept of algorithms is also in this mission and throughout the mission pack. Review and practice algorithms with your students and encourage them to see algorithms in their daily lives.
  • Extensions and cross-curricular projects are included to enhance the concepts in the mission. Use the extensions to extend students' programming experience. A remix is not explicitly planned here, but you can add one as an option for additional learning. A remix is planned after Mission 3.
🗺️

Lesson Outline

🗣️Warm-up / Hook

Students access prior knowledge by answering the pre-mission questions in the assignment doc.

  • Ask: "What is the difference between a light switch on the wall and a doorbell button? Why would a designer pick one over the other?"
  • Ask: "If you were in charge of launching a rocket, what would have to be true before you were allowed to press the launch button?"
Teaching tip: Pass a switch and a button around the room before any code is written. Students feel that the switch stays where you put it and the button springs back, which is the whole distinction this mission rests on.
📖Introduce the Mission

Set up the launch scenario and front-load the new input code before students start typing.

  • Frame the project: a power switch for the engines, a countdown for personnel, and a launch button for Mission Control.
  • Introduce exp.digital_in(exp.PORT0) for setting up an input peripheral, next to the exp.digital_out() students already know.
  • Walk through the values carefully. switch.value is True when the switch is out and False when it is in. button.value is True when it is not pressed.
  • Sketch the three branches of the infinite loop on the board before students code them: engines off, engines on and waiting, engines on and launch button pressed.
Teaching tip: The inverted logic is the number one stumbling block in this mission. Say out loud "pressed means False" a few times and have students say it back before they write the conditional.
💻Coding Time

Students work through the mission objectives in CodeSpace, taking notes and answering questions in their assignment doc as they go.

  1. Connect the switch and the button to the CodeX and set them up as digital inputs.
  2. Read the switch value and use it to turn the red engine LED on and off.
  3. Build the infinite loop and add the three branches, including the branch that checks two conditions.
  4. Write the countdown function, using display.fill() and the flashing white LED, and complete the Checks for Understanding.
  5. Break out of the loop at lift-off and finish the LiftOff program.
Teaching tip: If a student's countdown fires the moment the program starts, check the button condition first. It is almost always a True that should be a False.
Teaching tip: Point out every time students write a function that they are practicing abstraction. The countdown function is a clean example, Mission Control presses a button and never sees the details.
Teaching tip: Fast finishers can start the challenges: rocket images during lift-off, random pixel colors during the countdown, or CodeX buttons as astronaut ready checks.
🧑‍🤝‍🧑Class Debrief

Bring the class back together to lock in branching, abstraction, and algorithms.

  • Ask: "Why is a switch the right choice for engine power and a button the right choice for launch?"
  • Ask: "Walk me through your three branches. What has to be true for each one to run?"
  • Ask: "What does the countdown function hide from the rest of your program, and why is that useful?"
  • Ask: "Where does your program break out of the loop, and what would happen if it never did?"
Teaching tip: Use the practice set on evaluating conditional statements here, then the exit ticket where students construct a conditional of their own. Together they take about ten minutes and tell you who is ready for Mission 3.
✏️Wrap-up & Review

Students answer the reflection question in the assignment doc, add a journal entry about their learning experience, and submit the LiftOff program.

Use the Mission 2 Review Questions or the Mission 2 Review Kahoot! through whichever method you prefer, class discussion, Kahoot!, or an LMS quiz.

Teaching tip: Have students write their launch algorithm in plain English on the back of the exit ticket. Comparing a few versions out loud shows the class that one problem has many correct algorithms.