Teacher Resources: Python with Robots MS - Mission 3-2

Mission 3-2: Bright Byte Lights Lesson 2 | Python with Robots MS
Mission 3-2 Lesson Plan

Bright Byte Lights Lesson 2

Students will convert between decimal and binary numbers and use them to control LEDs.

⏰ 40-60 min 🎯 Grades 6-8 💻 CodeSpace 🤖 CodeBot 🐍 Python
View Lesson Outline
📋

Overview

Mission 3-2 introduces students to binary numbers - the foundation of how all computers store and process information. Students learn to convert between decimal and binary, then apply that knowledge directly to hardware by using binary values to control CodeBot's user LEDs and line sensor LEDs.

🎯 Mission Goal: Students will convert between decimal and binary numbers and use them to turn on/off user LEDs and line sensor LEDs on CodeBot.

🎯

Learning Targets

  • I can define "bit" and "byte".
  • I can convert a decimal number to binary.
  • I can convert a binary number to decimal.
  • I can use a binary number to turn on/off user LEDs.
  • I can use a binary number to turn on/off line sensor LEDs.
💡

Key Concepts

  • Computers use binary numbers to represent all information.
  • You can control (turn on and off) LEDs using binary numbers. This is much faster, and fewer lines of code, than turning on and off each LED individually.
  • Binary numbers have only two digits: 0 and 1, and use the base-2 number system.

Assessment Opportunities

☑️

Success Criteria

  • Convert a number between 0 and 15 to binary
  • Convert a binary number to decimal
  • Convert a number between 0 and 255 to binary
  • Write code using binary to turn on/off user LEDs
  • Write code using binary to turn on/off line sensor LEDs
🧰

Classroom Materials

  • CodeBot
  • USB cable
🌍

Real-World Applications

💻Computers combine binary digits (bits) into binary codes that enable them to represent any type of data, from numbers and text to images and sounds.
🚀

Extensions & Cross-Curricular

ExtensionMake a poster or chart of Python commands.
ExtensionUse the line sensor LEDs and user LEDs in a light show.
ExtensionDo an unplugged activity with binary, like binary bracelets.
MathBinary uses base 2. Discuss number systems with other bases, like the octal system with base 8 or hexadecimal with base 16. Other bases are fun, too, like base 3.
Lang ArtsSupports language arts through reading instructions and reflection writing.
🔤

Vocabulary

Binary - A number system, or computer language, that uses only 0s and 1s.
Bit - A single binary digit (on/off or 1/0).
Byte - A set of 8 bits of binary data.
Bit banging - Controlling hardware with binary digits.
🐍

New Python Code

leds.user(16)Use a decimal number to turn on/off all user LEDs
leds.user(0b10101010)Use a binary number to turn on/off all user LEDs (0b for binary, then 0=off, 1=on for each LED)
leds.ls(0b11111)Use a binary number to turn on all line sensor LEDs
leds.ls(0b00100)Use a binary number to turn on only the middle line sensor LED
📐

Standards

CSTA Standards — Grades 6–8

2-AP-10 2-AP-11 2-AP-12 2-AP-13 2-AP-14 2-AP-16 2-AP-17 2-AP-19
📝
Preparing for the Lesson
  • Make sure CodeBot robots are charged and USB cables are ready.
  • Watch the Secret Coders video ahead of time so you can introduce it naturally and answer questions.
  • Review the BinaryLEDs sample code so you can help students who get stuck on the binary LED syntax.
  • Consider having a printed binary/decimal conversion chart handy for students who need a visual reference during the activities.

🧑‍🏫
Teacher Notes
  • Binary conversion is often the toughest concept in this unit. The Secret Coders video does a great job making it accessible - show it before students start the activities to give them a concrete mental model.
  • When students write leds.user(0b00001111), connect it back to what they already know: each 0 or 1 in the binary number maps directly to one LED being off or on. This makes the bit/byte concept tangible.
  • Watch for students confusing the number of LEDs (8 user, 4 line sensor) with the binary place values. Remind them that for user LEDs they need an 8-bit value, and for line sensor LEDs they need a 4-bit value.
  • The Kahoot linked above is a good warm-up or exit ticket for Objective 6. Run it as a class before the quiz to help students feel confident.
🗺️

Lesson Outline

💡Lesson Tips and Tricks
Teaching tip: You can use a variety of discussion strategies to get the most engagement from your students. For example, you can have students write their answers before asking anyone for an answer. You can use one of many think-pair-share methods. You can have students write their answer and share with someone, and then have other students share answers they heard from their peers. You can randomly select students to answer.
🗣️Warm-up / Hook - Slides 2-4

Students can write in their log first and then share, or discuss first and then write in their log.

  • Question: How many ways can you represent the value 5?
  • This question is to get students to think about how the number we use is just a symbol. There can be many ways to represent 5: fingers, objects, tally marks, domino or die, words, math problems, etc. This is a good question to have students share out their ways and see how many representations they can come up with. You can show slide 3 for examples.
  • Question: How does a computer represent 7?
  • Students are not expected to know the real answer to this question. Appreciate their creativity as they discuss how a computer may represent 7. Some students may know that a computer uses binary numbers.
💻Mission 3 Lesson 2 Activities

Each student will complete a Mission Log. Students could work in pairs through the lesson, or they can work individually. They will need a CodeBot and cable for the lesson.

Teaching tip: Objective 6 Introduction - Slides 5-6. The two slides contain the information from the first two paragraphs of Objective 6. After that, the students don't need the instructions in CodeSpace for a while.
Teaching tip: Binary Numbers - Slide 7. This slide introduces binary numbers and has a link to a video. The video is on YouTube. The entire video is about 9 minutes, but the beginning and end talk about the book series. Recommendation: start at 1:09 and stop at 7:32, for about a 6.5-minute clip. The video ends with instructions for Activity #1.
Teaching tip: Activity #1 - Slide 8. This slide refers students to their mission log to complete Activity #1. It is based off the video. The instructions say to use small objects, like bits of paper, to fill in the columns. If students are going to do this, you need to have this document (or a similar paper) printed for students to use.
Teaching tip: Binary Numbers - Slides 9-11. These slides transition from 4-bit numbers to 8-bit numbers.
Teaching tip: Binary Numbers - Slides 12-13. These slides give examples of converting binary to decimal and decimal to binary. You may need to go over the examples and indicate what a 0 and 1 mean on the chart.
Teaching tip: Activity #2 - Slide 14. This slide refers students to their mission log to complete Activity #2. It is based off the examples from slides 12-13.
Teaching tip: Binary Numbers - Slide 15. This slide transitions to using binary in Python code to turn on/off LEDs.
Teaching tip: Activity #3 - Slides 16-18. These slides have the instructions for completing the activity. Students will use the Console Panel in CodeSpace - they type code directly into the console and see the results immediately on CodeBot. Note: this activity continues after some more instruction.
Teaching tip: Binary Numbers - Slides 19-20. These slides transition to using binary in Python code to turn on/off LEDs.
Teaching tip: Activity #3 continued - Slide 21. Students continue Activity #3. They will use a different Python command that uses binary to turn on/off LEDs. They will make up their own combinations of LEDs to try and record them in their mission log.
Teaching tip: Binary Numbers - Slide 22. This slide shows the Python code for turning on/off the line sensor LEDs.
Teaching tip: Objective 6 - Slide 23. This activity is the same one in Mission 3 Objective 6. Students can read the instructions in CodeSpace or from the slide. They must complete the three bullet points to meet the goal. They can do more than those three lines of code. They should be able to do the program without CodeTrek, but it is there to help them if needed.
Teaching tip: Extension - Slide 24. If you have time, students can do an extension by combining what they have been learning throughout Mission 3 so far.
Teaching tip: Quiz - Slide 25. Students take a short quiz over objectives 1-6.

Optional: 🗝️ Mission 3 Obj. 6 Kahoot! Review - A review Kahoot! is available for this objective. You can do the Kahoot together as a class, or assign it independently.

If you are not doing the three activities on binary and decimal conversion, you can skip the Kahoot! Review, or use the Mission 3 Obj. 1-6 Kahoot! Review.

🧑‍🤝‍🧑Post-Mission Reflection
  • There are 2 slides that discuss real-world applications and how computers use binary to represent all data. You can expand on this information as needed.
  • You can use an extension or cross-curricular activity as a post-mission activity.
  • You can use the Mission 3 Obj. 6 Kahoot as a lesson review. (link above)
  • End by collecting the Mission 3 Lesson 2 Log.