Haunted Code Chronicles - Mission 3: The Kitchen
The Kitchen
Students will learn about decimal and hexadecimal numbers and bitwise operators, and use them in code to control LEDs.
Overview
Mission 3 takes students into the kitchen for a crash course in how computers count. Students learn the binary and hexadecimal number systems and use them to control a whole string of LEDs with a single line of code. They work through logical operators and bitwise operators, read a line sensor, and put it all together to unhex the jack-o-lanterns and escape through the kitchen door.
π― Mission Goal: Students will learn about decimal and hexadecimal numbers and bitwise operators, and use them in code to control LEDs.
Learning Targets
- I can control the user LEDs using binary numbers.
- I can evaluate expressions with logical operators.
- I can evaluate expressions with bitwise operators.
- I can read a line sensor.
Key Concepts
- The binary number system has two digits: 0 and 1. Computers use them to represent ON and OFF, and they can also represent True and False.
- Hexadecimal numbers use base 16, and they are also used by computers to represent numbers.
- Binary and hexadecimal numbers can be used to turn on and off a string of LEDs.
- Logical operators allow for a combination of conditions. Logical operators are AND and OR.
-
Bitwise operators are used to combine binary or hexadecimal numbers. Bitwise operators are
&(and) and|(or).
Assessment Opportunities
- Complete the Mission 3 Activity Guide.
- Complete and turn in program BinaryBits after Objective 4.
- Complete and turn in program UnhexPumpkins after Objective 5.
- Complete and turn in program KitchenDoorDash after Objective 6.
- Record the score for the mission, found in the class dashboard.
- Write a paragraph about their coding experience and what they learned.
Success Criteria
- Turn on and off a string of LEDs using binary (0b)
- Evaluate an expression that has a logical operator
- Turn on and off a string of LEDs using hexadecimal (0x)
- Evaluate an expression that uses binary numbers and a bitwise operator
- Evaluate an expression that uses hexadecimal numbers and a bitwise operator
- Read a line sensor and use the value to unhex a pumpkin
Digital Resources
Classroom Materials
- βΈLaptop/computer with Chrome browser
π€
Vocabulary
βΎ
π
New Python Code
βΎ
0x1A & 0x56Bitwise AND operator
0x1A | 0x56Bitwise OR operator
π
Standards
βΎ
CSTA Standards - Grades 3-5
CSTA Standards - Grades 6-8
CSTA Standards - Grades 9-10
CSTA Standards - Grades 11-12
- Go through the Mission in advance, if you can. Try at least the first couple of objectives.
- Be familiar with using binary and hexadecimal numbers to control the user and line sensor LEDs.
- Objective 1 gives a quick lesson on binary. Look it over to see if you need to do any additional front-loading or if the instructions are enough.
- The mission has two activity guides. They use the same questions, but the alternative guide (alt) gives added support with the questions. Use the one that best fits the needs of your students.
- This mission introduces and uses binary and hexadecimal numbers. If you want additional practice, try the Binary Lesson.
- Objective 5 is a difficult challenge. Read the tips and tricks for the objective below to help your students complete the challenge.
Lesson Outline
The warm-up has two questions. Have students share their answers as a class discussion or think-pair-share. Go over the mission introduction to help them understand what will be expected during this mission.
0b. You can also use the same technique to turn on the line sensor LEDs. The only difference is there are five of them instead of eight. Example: leds.ls(0b00110)
answer = True or False
| (or) and & (and).0x. Here is a sample code:a = 0x26 b = 0xD5 leds.user(a | b)
The reflection questions can be written, shared as a class discussion, or handled through a think-pair-share activity. This is an opportunity to promote a growth mindset.