1 of 13

The Arizona STEM Acceleration Project

Loops and Logic

2 of 13

Loops and Logic

A 7th grade STEM lesson

Scott Blevins

Amanda Sibley

3/22/2024

3 of 13

Notes for teachers

Now students know what sensors are on their drone and how to read their outputs manually. Students also know how to program loops and conditional statements. This is a major key to programmed autonomous flight. Conditional statements and loops will allow a program to read for data from a sensor and “make decisions” based on conditional statements as to what the code should do next.

Developing Predictive Models: Click here

Error Sources and Sensor Integration: Click here

Sensor Integration: Click here

Loops and Logic: Click here

Sensor Integrated Movement: Click here

Sensor Integrated Movement- Taking Flight: Click here

List of Materials

  • Charged drone
  • Charged controller
  • USB connection cable
  • Computer for programming

4 of 13

Standards

Standards

Arizona Science Standards

Science and Engineering Practices:

Develop a model

  • Develop a model that allows for the manipulation of a proposed object, tool, process or system

Using mathematics and computational thinking

  • Apply concepts of ratio, rate, percent, basic operations, and simple algebra to scientific and engineering questions and problems.

Arizona Mathematics Standards

7.RP.A Analyze proportional relationships and use them to solve mathematical problems and problems in real-world context.

5 of 13

Objectives:

Students will be able to use loops and conditional logic in the Blockly Senior programming environment to check the output of a sensor and make a decision based on those outputs.

6 of 13

Agenda (4 Days)

Day 1:

Students will learn about the value of a variable in programming. They will learn the logistics of creating a variable and will begin to see how a variable can be used in a loop to store a sensor input value.

2.3: Variables (PDF)

7 of 13

Agenda (4 Days)

Day 2:

In this lesson students will learn about basic conditional statements. This will focus on if-else statements and their variants. The if portion will ask a yes/no question and the based on the yes/no response will direct to an else condition which may include specific direction of an operation to perform.

2.4: Conditionals (PDF)

8 of 13

Agenda (4 Days)

Day 3:

Students will work through the activity link HERE to learn about loops. Students will see that a loop can be used to perform a task repeatedly or to perform a task until certain requirements are met.

2.5: Loops (PDF)

9 of 13

Agenda (4 Days)

Day 4:

In this lesson students will learn how to develop a remote control code. Students will learn how to write a code that responds to keys pressed on the keyboard.

2.8: Remote Control (PDF)

10 of 13

Intro/Driving Question/Opening

How can I develop a code that responds to input from a user or sensors on board the drone?

11 of 13

Hands-on Activity Instructions

  • Students will work in small groups based on the number of drone control stations that are available. Try to keep the group numbers as small as possible based on the number of students and resources.
  • Each day have student teams work through a lesson and complete the challenge task that is listed at the end of the lesson.

12 of 13

Assessment

The work that students do when they complete the challenge task at the end of each lesson will demonstrate how much students are understanding of the material at hand.

13 of 13

Differentiation

Pair small groups based on ability- stronger peers with those who are struggling.

Check in with students consistently throughout the activity.

Remediation

Extension/Enrichment

Ask students who are getting the hang of it to create a cheat sheet. Take the best cheat sheet and give to groups in following lessons to serve as memory aids (remediation).