SPIKE™ Prime with Python

Leading the Team with Loops

Program a model to move using loops

90-120 min.
Intermed.
Years 7-9 OR Key Stage 3

Questions to investigate

• How can a challenge determine the best type of loop to use in a program?

Prepare

• Ensure SPIKE Prime hubs are charged, especially if connecting through Bluetooth.

Engage

(Group Discussion, 10 minutes)

Leo the Trainer and the Coach are ready to hand over the team to you for leading the final exercise. Brainstorm different types of exercises, stretches, and yoga poses that would be a good cool down for the team.

Create a chart as a class to organize the different ideas by the types of movements. Consider a chart like this:

00

Explore

(Small Groups, 45 minutes)

Students will design and build a new trainer to lead their exercise. Prompt students to use the chart above to think about what they need to design and build to complete the exercise move.

Challenge students to think about the movements that will be needed to complete the exercise. Allow students time to investigate how to move properly to think about their use of motors in their design. Students should sketch their design.

Remind students to test their design several times in order to ensure the movement works. Students should consider tradeoffs in their design such as the need to design an entire person if only moving legs in order to spend time on the most important part of the design. Consider pointing students to the BUILD section of the SPIKE App for inspiration if needed.

Requirements for this challenge:
• The model must be able to complete a simulation of an exercise.
• The model should include at least one motor for movement.
• The program must include a type of loop.
• Prior to writing code, students must show a sketch of their design and write an explanation of what they want to the code.
• Students should use the comment feature in their Python code to explain what the lines of code are meant to do.

Allow students time to design and program their new trainer. Remind students to test their program several times and change it as needed in order to ensure the model moves as expected.

Explain

(Whole Group, 15 minutes)

Students should share their design and explain how it works. Conduct an initial sharing session with students.

Ask students questions like:
• How did you program your model to complete your chosen exercise? Ask students to share their program comments to explain.
• What decisions did you have to make while creating your design?
• What type of loop did you choose? Why this type and not others?
• What were areas that you had to debug or troubleshoot?
• What was difficult about this challenge?

Elaborate

(Small Groups, 25 minutes)

Allow students additional time to complete their program after the initial sharing session.

Students should finalize their design and program. Encourage students to incorporate any new ideas they got from the sharing session.

Leave the models together if you are completing the lesson on feedback next.

Evaluate

(Group Exercise, 10 minutes)

Teacher Observation:
Discuss the program with students. Ask students questions like:
• What was difficult about this challenge?
• What was your approach to solving this challenge?
• What type of loops did you include and why?

Self-Assessment:
Have students answer the following in their journals:
• What did you learn today about designing a model to do a specific task?
• What characteristics of a good teammate did I display today?
• Ask students to rate themselves on a scale of 1-3, on their time management today.
• Ask student to rate themselves on a scale of 1-3, on their materials (parts) management today.

Teacher Support

Students will:
• Design a model for repetition.
• Program a model to move using loops.

• SPIKE Prime sets
• Device with SPIKE App installed
• Student journal

CSTA
2-CS-02 Design projects that combine hardware and software components to collect and exchange data.
2-AP-13 Decompose problems and subproblems into parts to facilitate the design, implementation, and review of programs.
2-AP-16 Incorporate existing code, media, and libraries into original programs, and give attribution.