a1tD00000087zpIIAQ

Course: Programming with CoDrone Lite
4-Loops with CoDrone Lite

  • 4-7 grade
  • Beginner

Lesson Description:

Loops will be part of almost every program that a student makes to fly their CoDrone. These lessons will cover what loops are and how they work, and then students will create and run their own programs using loops. In this lesson, students will include loops in their programs and create a program that climbs a staircase.

Objective: 

  • Explain what a loop is, how it works, and why it is used with choreography. Create and run a program in Snap that involves both simple and combined loops that has a drone flying in a staircase pattern.

image description

Lesson Modules


Teaching Tips:

  • Have students talk in groups to figure out what a loop is and how it might be used in programming.
  • Split students up into teams and have them choreograph their own dances. The choreography should be 30-60 seconds, school appropriate, and should have at least three repeated series of steps. Once their dance is choreographed, they will need to write out their dance steps and anything that is a loop should have a bracket around the step with loop written next to it.  Next, they will pass their written choreography to the team on their left and perform their dance moves according to the instructions. Performances will need to be done one at a time so the team that wrote the choreography can see if their instructions made sense.
  • Which groups were successfully able to perform? What helped them out? Which groups were not successfully able to perform? What problems did they run into? What do they think a computer or robot would do in that situation and how would they fix it?


Do you know what is a loop? How might it be used in programming?



Teaching Tips:

  • At this point, students should have enough experience with coding to program their drone to fly in a square. Ask them to do this without using any loops. After everyone has completed their code and tested it out, ask them to complete the following challenge. 

Testing you

You have three programs that you need loops for. Which loop would you use for each program? Each type of loop is used only once. Discuss with your classmates:

  1. For playing your favorite song three times
  2. For flying your CoDrone until the space key is hit
  3. For keeping a digital clock running

Teaching Tips:

  • Ask students to use pseudocode to explain to a partner how they got their drone to move in a square or staircase pattern in Snap using both their own words and the appropriate academic language.
  • Have students complete the Stair Challenge in the Loops in Flight lesson. For an extra challenge, have obstacles set up in ascending to descending height that the students will need to avoid. The students who successfully complete the challenge with the least amount of blocks win!

Challenge

Activity: Stair challenge

Make your CoDrone fly up a set of stairs (fly up, forward, up, forward, etc) and then fly back down!

Challenge rules:

  1. Use variables for delays.
  2. Use loops for any code that will be repeated more than once. Hint: you should have two loops in your program!
  3. Your CoDrone has to fly up at least three stairs.
  4. Your CoDrone needs to land!

Teaching Tips:

In a journal or on a worksheet have students answer the following questions. If there is time left, you can make students to share their answers and experiences.


What is a loop? Why would a programmer use loops in their code?


Explain one of your program using pseudocode.