... | ... | @@ -22,12 +22,12 @@ |
|
|
>Mount the sensor on the car and make a program that use and test the class BlackWhiteSensor.java. After calibration, place the car with the light sensor over different dark and bright areas and investigate how well the BlackWhiteSensor works.
|
|
|
>
|
|
|
>#### Plan
|
|
|
>We first mounted the color sensor on the car as showed on the picture below. The color sensor is placed just above the ground surface. After mounting the color sensor we tested the readings on different surfaces and under different light settings. These findings are presented in a table under the results section.
|
|
|
>We first mounted the light sensor on the car as showed on the picture below. The light sensor is placed just above the ground surface. After mounting the sensor we tested the readings on different surfaces and under different light settings. These findings are presented in a table under the results section.
|
|
|
>
|
|
|
> ![1](http://gitlab.au.dk/uploads/group-22/lego/974492fb01/2.jpg)
|
|
|
>
|
|
|
>#### Result
|
|
|
> We decided to test the color sensor under different settings. First we tested how it reads black and white values at different surfaces (plastic and paper) and under different light settings (dark and bright). As further investigation we tested how the sensor is able to detect dark green and light green. The findings from the color sensor tests are presented in the table below:
|
|
|
> We decided to test the light sensor under different settings. First we tested how it reads black and white values at different surfaces (plastic and paper) and under different light settings (dark and bright). As further investigation we tested how the sensor is able to detect dark green and light green. The findings from the light sensor tests are presented in the table below:
|
|
|
>
|
|
|
> | Black reading | White reading | Black White Difference | Black White Threshold| Dark Green reading | Light Green Reading | Green Difference| Green Threshold |
|
|
|
> | -------- | -------- | -------- |--------|-------- |--------|--------|--------|--------|
|
... | ... | @@ -45,7 +45,7 @@ |
|
|
>
|
|
|
> ##### Dark Green and Light Green Results:
|
|
|
>
|
|
|
> As an extension we also tested the sensor in a setting where the to colors to be distinguished were closer to each other. For this purpose we chose green. The table shows that the sensor generally has a hard time differentiating the green colors regardless of the surface. However it seems to be possible under bright light settings with a paper surface and under dark settings with a plastic surface. It is interesting that the "green difference" changes from nothing (0) to 4 when changing the surface under dark settings. The reason for this behavior might be that plastic has a better capability to reflect the light from the color sensor due to it's reflective surface.
|
|
|
> As an extension we also tested the sensor in a setting where the two colors to be distinguished were closer to each other. For this purpose we chose green. The table shows that the sensor generally has a hard time differentiating the green colors regardless of the surface. However it seems to be possible under bright light settings with a paper surface and under dark settings with a plastic surface. It is interesting that the "green difference" changes from nothing (0) to 4 when changing the surface under dark settings. The reason for this behavior might be that plastic has a better capability to reflect the light from the color sensor due to it's reflective surface.
|
|
|
>
|
|
|
>## Exercise 2: Line Follower with Calibration
|
|
|
>
|
... | ... | @@ -53,4 +53,23 @@ |
|
|
>Try the LineFollowrCal.java. The program uses the simple class Car.java to move the car.
|
|
|
>
|
|
|
>
|
|
|
>#### Result! |
|
|
\ No newline at end of file |
|
|
>#### Result!
|
|
|
>
|
|
|
|
|
|
private int read(String color){
|
|
|
|
|
|
int lightValue=0;
|
|
|
|
|
|
while (Button.ENTER.isDown());
|
|
|
|
|
|
LCD.clear();
|
|
|
LCD.drawString("Press ENTER", 0, 0);
|
|
|
LCD.drawString("to callibrate", 0, 1);
|
|
|
LCD.drawString(color, 0, 2);
|
|
|
while( !Button.ENTER.isPressed() ){
|
|
|
lightValue = ls.readValue();
|
|
|
LCD.drawInt(lightValue, 4, 10, 2);
|
|
|
LCD.refresh();
|
|
|
}
|
|
|
return lightValue;
|
|
|
} |
|
|
\ No newline at end of file |