Podcast
Questions and Answers
Which programming concept is covered in this video?
Which programming concept is covered in this video?
- Selection (correct)
- Polymorphism
- Iteration
- Recursion
What is the goal of programming the Telo drone in this video?
What is the goal of programming the Telo drone in this video?
- To fly in a zigzag pattern (correct)
- To fly in a straight line
- To fly in a random pattern
- To fly in a circular pattern
How is the initial turn adjusted in the code to ensure a clean zigzag flight pattern?
How is the initial turn adjusted in the code to ensure a clean zigzag flight pattern?
- It is turned to the right by 90 degrees
- It is turned to the left by 45 degrees
- It is turned to the left by 90 degrees
- It is turned to the right by 45 degrees (correct)
Flashcards are hidden until you start studying
Study Notes
Programming a Zigzag Flight Pattern with If Statements
- This is the seventh video in the "Get Control" video series for using the Telo drone with Drone Blocks.
- In the previous video, the drop rate and drop down timer code were programmed using maths.
- This video covers the programming concept of selection, specifically the if statement.
- The goal is to program the Telo drone to fly in a zigzag pattern, which involves abrupt alternate left and right turns.
- The code includes five variables: counter, forward distance, zig, zag, and total zigzags.
- These variables are dragged onto the stage and duplicated using the "duplicate" function.
- The loop, or iteration, is used to repeat the zigzag flight pattern a certain number of times.
- The code for a zigzag without an if statement is demonstrated and flown in the drone simulator.
- The if statement is introduced to determine if the drone should turn left (zig) or right (zag).
- The if statement includes an else statement to cover both possibilities.
- The total number of zigzags is divided by two to account for the fact that each iteration of the loop determines whether to zig or zag.
- The code is adjusted to offset the initial turn to the right by 45 degrees to ensure a clean zigzag flight pattern.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.