Wait Statement Challenge
Part 1
Create and run the sample code below on your robot. Observe how far the robot travels. Then modify the amount of time that the robot travels by changing the value of line 5 from 500 to 1000. Download and run the program and observe the distance the robot travels. Repeat these steps for values of 2500 and 3250 as well. In each case, the variable that you are manipulating is the amount of time that the robot “waits” until it does something else.
Create and run the sample code below on your robot. Observe how far the robot travels. Then modify the amount of time that the robot travels by changing the value of line 5 from 500 to 1000. Download and run the program and observe the distance the robot travels. Repeat these steps for values of 2500 and 3250 as well. In each case, the variable that you are manipulating is the amount of time that the robot “waits” until it does something else.
SAMPLE CODE:
1 task main ( )
2 {
3 startMotor (leftMotor, 127);
4 startMotor (rightMotor, 127);
5 wait (500);
6 }
7
1 task main ( )
2 {
3 startMotor (leftMotor, 127);
4 startMotor (rightMotor, 127);
5 wait (500);
6 }
7
Part 2
Measure the average that the robot travels in 500 milliseconds, using three attempts:
Measure the average that the robot travels in 500 milliseconds, using three attempts:
- Attempt 1:
- Attempt 2:
- Attempt 3:
- Average Distance:
|
Now find the average distance for the 1000, 2500, and 3250 trials. In each case, run the program three times
Measure the average distance that the robot travels in 1000 milliseconds:
- Predict distance -
- Attempt 1:
- Attempt 2:
- Attempt 3:
- Average Distance:
- Predict distance -
- Attempt 1:
- Attempt 2:
- Attempt 3:
- Average Distance:
- Predict distance -
- Attempt 1:
- Attempt 2:
- Attempt 3:
- Average Distance:
Conclusion:
- What is the correlation between distance and time, if any?
- Which millisecond value gave you the largest percentage of error? The smallest? Speculate why in both cases.
- What could you do to reduce error in the system?