- :-

Topics Covered

• Expanding Remote Control

1. 1. What does the If/Else Conditional Block allow you to do?
2. It allows you to end the program immediately.
It allows you to run one set of commands if a condition is met, or a second set of commands if a condition is not met.
It allows you to trace through your program execution.
It allows your program to repeat forever.
3. 2. True or False: When the robot reaches an If/Else Conditional Block it makes a decision.
4. True
False
5. 3. True or False: The else branch of an If/Else Conditional Block gets its own condition.
6. True
False
7. 4. When does the code under the if branch of the If/Else Conditional Block run? When does the code under the else branch run?
8. Code under the if branch runs when the condition is false. Code under the else runs when the condition is true.
Code under the if branch runs when the condition is true. Code under the else runs when the condition is false.
Code under the if branch runs when the condition is true. Code under the else always runs.
Neither set of code ever run. The condition for the If/Else Conditional Block cannot be met.
Try It!
Try it! 1

LED Feedback

Program the Touch LED to output yellow when the robot is moving forward based on the VEX IQ Controller button press, and blue when the robot is being driven by the VEX IQ Controller joysticks. Try it!

Mini Challenge

Mini Challenge 1: Backwards Driving Assistance

Upgrade your program so that it has one more Button Press movement!
 Modify your program so that it: Moves straight backwards if the down button in group F is pressed Else, moves straight forward if the up button in group F is pressed Else, resumes normal remote control using the joysticks.

So far, we used If/Else Block to make robot think about only 2 different scenarios. Now, think very carefully and visualize the steps the robot would take to think about 3 different scenarios!

You will need more than one If/Else block to do this challenge.

One way to do this challenge is to place second If/Else Statement Block inside 'Else' branch of the first If/Else statement!

The robot will look at the outer-most If/Else statement first. If it is not true, it will run code inside 'Else' branch, which contains another If/Else statement to check if it is True or False.

Mini Challenge 2: Full Button Control

Create a new program where the steering of the robot is fully controlled using the VEX IQ Controller buttons. Assign one button to make the robot move forward, one to make the robot move backward, one for turning right, and one for turning left. Complete a simple maze using the program.
 Create a new program that assigns each of the following movements to different buttons on the VEX IQ Controller Move Backward Move Forward Turn Right Turn Left Make a simple maze that requires robot to make a turn at least 2 times. Using your program, navigate your robot around the simple maze!

Create a repeatUntil loop where each time the program flow passes the loop, it checks up to 4 different buttons

Think about how you would check 4 different if-statements if you can only decide between 2 things at a time

You can use multiple nested If-Else block where If-Else block is placed inside another If-Else block.