Haunted Code Chronicles - Mission 1: The Front Porch

Mission 1 Lesson Plan

The Front Porch

Students will learn how to move CodeBot and play notes on the speaker.

⏰ 45-120 minutes 🎯 Grades 5-12+ πŸ’» CodeSpace πŸ€– CodeBot 🐍 Python
View Lesson Outline
πŸ“‹

Overview

Mission 1 opens the Haunted Code Chronicles on the front porch. The first objectives introduce students to CodeSpace and to CodeBot itself, including the text editor, the objective panel, goals, CodeTrek, Hints, and the camera controls for the 3D scene. From there students find CodeBot's LEDs and motors, light up the darkness, rotate and drive the 'bot around the porch, chase off spiders, and use the speaker to play notes.

🎯 Mission Goal: Students will learn how to move CodeBot and play notes on the speaker.

🎯

Learning Targets

  • I can use the features of CodeSpace (CodeTrek, Hints, text editor, objective panel, goals, etc.)
  • I can identify and write code for CodeBot's LEDs and motors.
  • I can use camera controls to view the scene.
  • I can move the CodeBot forward, backward, rotated and in a curve.
  • I can play notes using CodeBot's speaker.
πŸ’‘

Key Concepts

  • The first objectives introduce CodeSpace and CodeBot (#1-9).
  • There are many ways to program the 'bot to accomplish the task. Celebrate the creativity of your students.
  • CodeBot's motors must be enabled before the wheels can move.
  • Students cannot copy and paste from CodeTrek, but they can copy and paste code in the text editor.
  • Comments are not required, but they are helpful.
βœ…

Assessment Opportunities

  • Complete the Mission 1 Activity Guide.
  • Complete and turn in program ActionBot after Objective 9.
  • Complete and turn in program SpiderTag after Objective 10.
  • Complete and turn in program RatSpells after Objective 11.
  • Complete and turn in program DoorDash after Objective 13.
  • Record the score for the mission, found in the Progress and Contests icon under Select Class.
  • Write a paragraph about their coding experience and what they learned.
β˜‘οΈ

Success Criteria

  • Identify key features of CodeSpace (text editor, objectives, objective panel, toolbox, camera controls, CodeTrek, Hints)
  • Identify an LED and a motor on CodeBot
  • Use camera controls to view the front porch
  • Write code to turn on an LED
  • Write code to rotate CodeBot
  • Write code to move CodeBot around the porch
  • Use the CodeBot speaker to play notes
🧰

Classroom Materials

  • β–ΈLaptop/computer with Chrome browser
πŸ”€

Vocabulary

β–Ύ
CodeBot - A computer on wheels with lots of sensors and controls built-in.
Motors - Programmable electric engines; powers the wheels.
LEDs - Light emitting diodes; tiny and efficient electronic components that produce light.
Comment - Notes to the programmer that are ignored by the computer.
🐍

New Python Code

β–Ύ
from botcore import *Import the botcore library so you can access CodeBot's hardware.
leds.user_num(0, True)Turns on user LED 0.
from time import sleepImport the sleep function from the time library.
motors.enable(True)Turn on, or enable, the motors.
motors.run(LEFT, 40)
motors.run(RIGHT, 40)
Move forward in a straight line at speed 40.
sleep(1.5)Pause program execution, but keep the motors running.
motors.enable(False)Turn off, or disable, the motors.
spkr.pitch(400) / spkr.pitch(note)Plays a specific note on CodeBot's speaker.
spkr.off()Turns off the speaker.
πŸ“

Standards

β–Ύ

CSTA Standards - Grades 3-5

1B-CS-02 1B-CS-03 1B-AP-08 1B-AP-12 1B-AP-15 1B-AP-17

CSTA Standards - Grades 6-8

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

CSTA Standards - Grades 9-10

3A-CS-03 3A-AP-13 3A-AP-14 3A-AP-16

CSTA Standards - Grades 11-12

3B-DA-07 3B-AP-10 3B-AP-11 3B-AP-16
πŸ“
Preparing for the Lesson
  • Students need an email address to use for creating an account. The email can be made-up or an actual email address.
  • Decide if you want to track students by setting up a class in the dashboard. If so, request and claim a license.
  • Look over the activity guide. Decide if you want students to use it. Will you print it or give it digitally?
  • Decide on the structure of your class. Will students work independently, with a partner, or as a class? Will you require students to turn in programs, or is completing goals appropriate for grading and assessment?

πŸ§‘β€πŸ«
Teacher Notes
  • 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.
  • Each mission has its own sound track that plays continuously. If the music gets overwhelming in the classroom, you can have students use headphones, or students can go to their preferences and mute the sound.
  • Objectives 1-9 introduce CodeSpace and CodeBot. Students program their first real challenge in Objective 10. They also have a programming challenge in Objective 12 and Objective 13.
πŸ—ΊοΈ

Lesson Outline

πŸ§‘β€πŸ€β€πŸ§‘Warm-up

You can start by showing the mission pack trailer or the blog page.

The warm-up questions can be written, shared as a class discussion, or handled through a think-pair-share activity. Change the questions if you have a different perspective for students to focus on when starting the mission pack.

πŸ’»Mission 1 Objectives
Objectives #1-5: These objectives introduce students to the CodeSpace environment. The activity guide has specific instructions to help with meeting the goals of individual objectives.
Objectives #6-7: These objectives introduce students to CodeBot's motors and LEDs. Students will click on the parts in the 3D simulator.
Objective #8: This is the first time a student must create a new file. It must have the name spelled exactly the same as what is in the goal. The goal will be met by turning on 3 LEDs, the 0, 4 and 7. They can get a higher score by turning on more than 3. The answers to the activity guide questions are in CodeTrek.
Objective #9: Students continue to use the same file for this objective. Students will not delete any code, just add to it. CodeTrek shows the code only for the required LEDs to turn on. If students did more, they should keep the code. It doesn't have to match perfectly. Also, the speeds of the motors in the added code don't have to be exactly the same as CodeTrek. The validator is only checking to see if the 'bot is rotated. However, students will move the 'bot A LOT during this mission pack, so they should practice all the different ways to move it. You can have students submit their ActionBot code for this objective if you want to check how they are doing.
Objective #10: Students create a new file for this objective. It does not have to be the same name as the one in the instructions. The challenge is to move CodeBot so it tags at least four spiders. The spiders can be tagged in any order. Students get a higher score for tagging all six spiders, but it is not required. Students can also get a higher score for speed. Important note: CodeBot doesn't move exactly the same way every time the code is run. If someone's code looks good but the program run is a little off, just reset the scene and run it again.
Helpful tips for Objective #10: Try different camera angles to find the one most useful to you. The easiest way to get three spiders is to back up, then move forward, since three spiders are in a row. Work at getting one spider at a time, adjusting the sleep and/or motor speed a little at a time. A student may have to run the code a few times, since it runs a little differently each time. Slower speeds have a little more consistency, so if someone struggles, have them go slower at first.
Objective #11: This objective does not use any programming. Students use the universal camera to explore the front porch and locate the envelope. They click on the envelope to meet the goal. The envelope is on the rocking chair.
Objective #12: The answer to the activity guide question is in the message from the envelope. This objective uses the CodeBot speaker to put rats to sleep. Make sure the speaker is enabled or you will not hear the notes as they play. The notes for the melody are given in the note. The code for the rats doesn't have to be complicated. The code for the first rat is given in CodeTrek. Students can follow the pattern for each additional rat, looking for the notes in the dictionary on lines 6-9. The boss rat must hear his melody two times. Don't forget the silence in between. Reset the scene each time you run the code to see the rats disappear. If your students have programming experience or want to try a shorter solution, they can use the hints. Two more ways to play the melodies are given, and each level of complexity will give the student bonus points.
Objective #13: This challenge is fairly straightforward: drive the 'bot through the hole in the door. CodeBot doesn't need to rotate or anything, just drive straight. A faster time gives a higher score. Students should remember to reset the scene each time they run their code. Don't forget to enable the motors!
πŸ§‘β€πŸ€β€πŸ§‘Reflection

The reflection question can be written, shared as a class discussion, or handled through a think-pair-share activity. This is a good time to review what was learned during the mission.