Programming If/Then & Forever Statements
If/Then Statements allow you to write a program that reacts to something occurring.
- Example 1: You drive up to a red stop light and after 30 seconds it turns green. The program would read: If timer equals 30 seconds, Then turn light to green.
- Example 2: You open the refrigerator door and the light turns on. The program would read: If button touching refrigerator door releases, then turn on light.
Now that you have learned how to code Motion for your robot, lets add an If/Then Statement.
Step #1: Write a program for your robot that has it move forward