... | ... | @@ -35,7 +35,31 @@ Observation: When the LED is turned Off, the percentage shown changes with the s |
|
|
|
|
|
Explain - The shadows and light reflected in the surface changes the measurement that is compared to the WhiteAndBlackThreshold, thus a color with shadows will appear darker than it really is.
|
|
|
|
|
|
### Exercise 3
|
|
|
### Exercise 3
|
|
|
In exercise three we change the sample interval to 10ms, 100ms, 500ms and 1000ms to see how this affects the LEGO car's movements across a squared line pattern and a circle pattern.
|
|
|
|
|
|
LightSensor light = new LightSensor(SensorPort.S3);
|
|
|
final int blackWhiteThreshold = 45;
|
|
|
final int sampleInterval = 10; // ms
|
|
|
|
|
|
A: 10 ms is changed to 100ms
|
|
|
|
|
|
Straight line course - Sample rate is too long, so it mostly drives to the right because white is the biggest area.
|
|
|
|
|
|
Circle course - The robot turns to the right if it does not see any black lines and therefore it turns more right than left, it works better than with the straight lines, because the black line turns right
|
|
|
|
|
|
B: is changed to 500 ms
|
|
|
|
|
|
Straight line course - The robot keeps turning right because it can barely see the black line, because it updates too slow.
|
|
|
|
|
|
Circle course - Again, it does not very often see a black line and therefore just turns around most of the time since it only changes direction when an update happens where the robot is just above the black line.
|
|
|
|
|
|
C: is changed to 1000 ms
|
|
|
|
|
|
Straight line course - Keeps turning right! It only see “white”. Again sample rate is too slow.
|
|
|
|
|
|
Circle course - Same as with the straight lines.
|
|
|
|
|
|
|
|
|
### Exercise 4
|
|
|
|
... | ... | |