Unit 7 - Auto-straightening and Variables

Unit Objectives

This unit shows students how the shaft encoder can be used to make their robot drive perfectly straight by introducing the concept of an if statement and an if-else statement.

Unit Teacher Notes

CLick here to download Teacher Notes for unit 7

Lesson 7.1 (300 minutes)

This lessons explains the main components of an if statement and how it can be used to help your robot drive perfectly straight. Additionally, it shows how a variable can be used in programming to help reduce errors and simplify code.


  • Understand how to use the values from the shaft encoder and the if statement to help your robot go straight.
  • Understand the purpose of a variable
  • Explain the benefits of using a variable
  • Demonstrate this knowledge by completing two challenges.

Quiz (30-60 minutes)

Quiz on the unit


  • Check for understanding