AP CSP - Python with CodeX - Mission 3
Mission 3: Light Show
Students program the four pixel LEDs on the CodeX, use variables, and add the sleep() function to create a light show.
Overview
This mission introduces the CodeX pixel LEDs, variables, and the sleep function. Students control the four pixel LEDs on the CodeX. They use a variable for the amount of delay in the sleep function to create a light show.
🎯 Mission Goal: Students will turn on and off the four RGB LEDs (NeoPixels) on the CodeX.
Learning Targets
- I can assign data to a variable.
- I can use variables to make code more efficient.
- I can set the pixels using built-in colors.
Key Concepts
- The CodeX has four NeoPixels that can turn on any color represented by RGB.
- The NeoPixels are numbered 0, 1, 2 and 3.
- When setting a pixel, the pixel number, color and optional brightness need to be given.
- A variable can be defined and used in code.
Assessment Opportunities
- Mission 3 Assignment
- Quiz after Objective 4
- Quiz after Objective 8
- Mission 1, 2 and 3 Kahoot Review
- Pixels1 program
Success Criteria
- Define RGB, literal, and variable
- Define and use a variable used in sleep()
- Define and use a variable for color that is changed and used multiple times
- Debug any errors in the code and keep a debugging table
- Write a program, run it, and save it to the CodeX
Digital Resources
Classroom Materials
- ▸CodeX (one per student or pair)
- ▸USB-C cable
- ▸Computer
Real-World Applications
The skills used in this project are used by professional software developers to build:
Extensions & Cross-Curricular
🔤
Vocabulary
▾
🐍
New Python Code
▾
from time import *Import time to use the sleep() function. Either import statement will work.
color = REDDefine a variable and assign it a value.
📐
Standards
▾
CSTA Standards - Grades 9-10
CSTA Standards - Grades 11-12
AP CSP Framework
AP CSP Framework - Computational Thinking Practices
- The assignment is best completed digitally. Prepare the assignment to give through your LMS.
- Start the lesson by going over the CodeX Mission Reminders slides.
- At the end of the lesson, discuss clearing the CodeX before turning it in. You can use the Clearing CodeX slides.
- Here is a list of all the built-in colors:
- BLACK
- BROWN
- RED
- ORANGE
- YELLOW
- GREEN
- BLUE
- PURPLE
- GRAY
- WHITE
- CYAN
- MAGENTA
- PINK
- LIGHT_GRAY
- DARK_GREEN
- DARK_BLUE
- Instructions for using the debugger are included in this mission, in Objectives 5 and 6.
- Another suggestion for assessment is for students to keep a daily journal, or use a reflection form for students to process information they learned and reflect on questions they may still have.
- You may consider having students (or the class collectively) keep a chart of errors and the ways to fix them.
- You can also add vocabulary to a word wall and keep a document or chart of the Python code learned during each mission.
- Refer to the lesson plans in the Python with CodeX Mission Pack Curriculum for additional challenges, cross-curricular suggestions, and additional information.
- The teaching guide gives the narration for one way to present the lesson.
Lesson Outline
This outline gives the narration for one way to present the lesson.
Use a discussion strategy, like journaling, working at boards, selecting random students, or a form of think-pair-share.
Talk to students about primary colors. They will probably say "red, yellow and blue." Mention that those are primary colors for paint, but for light the primary colors are red, green and blue. All color on your screen is made by mixing those three lights.
- Always start a new program by creating a new file and naming it appropriately. If you don't, you will lose all your previous work! Using descriptive file names is essential to finding the program later!
- You are making a project, not just working random problems. Focus on the project-based objectives and avoid rushing through the material too quickly.
- Test your understanding along the way by "coloring outside the lines". Try stuff!
- Collect all the Tools you find! (They're indicated with a wrench icon.)
- Read carefully. Usually the answer is right there in front of you!
Randomly group students into pairs for pair programming.
Students log in to one computer. Two computers can be used if they want to see instructions on one computer and work on the other computer. However, the assignment document requires snippets, so it will need to be open on the same computer as CodeSpace.
Students go to make.firialabs.com and begin Mission 3. They should have the digital assignment open.
✅ The assignment is complete and ready to turn in. Both students should include their names on the document and submit the final program.
✅ Important! Show students how to "clear" their CodeX by creating a program file without code. These instructions are included in the Clearing CodeX slides.
- Students create a new file called "Clear".
- Students type the code to clear the display.
- Run the code at the end of the class period to clear the code for the next person.
If this lesson is completed in one class period, the following can be used as a wrap-up. If you are on a block schedule and continuing to the next lesson, a wrap-up isn't necessary.
Formative assessment:
- Daily reflection journal
- Kahoot (in class or individual)
- Exit ticket on vocabulary (RGB, literal, variable)
- Group review on vocabulary (RGB, literal, variable)