... | ... | @@ -9,7 +9,7 @@ |
|
|
**Activity duration:** ?? hours
|
|
|
|
|
|
## Goal
|
|
|
In this lesson we build a LEGO car and equip it with a light sensor. We then seek to complete 6 exercises that each explore a certain aspect of the light sensor.
|
|
|
In this lesson we build a LEGO car and equip it with a light sensor. We then seek to complete 6 exercises, that each explore a certain aspect of
|
|
|
|
|
|
## Plan
|
|
|
What is your plan to reach the goal?
|
... | ... | @@ -25,6 +25,7 @@ What is your plan to reach the goal? |
|
|
The threshold value signifies a reference light value for which the program can determine whether it is above a white or black area on the ground. A light value below the threshold leads to the conclusion that the machine is above a black area, while for a value above the threshold, a white area. As such, we would like to use the mean value of black and white as the threshold.
|
|
|
|
|
|
(58+36)/2 = 47
|
|
|
|
|
|
(59+37)/2 = 48
|
|
|
|
|
|
### Exercise 2
|
... | ... | @@ -46,8 +47,7 @@ The following four graphs show the data collected from using 10ms, 50ms, 100ms a |
|
|
|------------|-------|-------|-------|------|
|
|
|
| Raw Light vale | 450 | 640 | 530 | 443 |
|
|
|
|
|
|
![GitHub Logo](/ex5_lp_black.png)
|
|
|
Format: ![Alt Text](url)
|
|
|
![Alt Text](/ex5_lp_black.png)
|
|
|
|
|
|
From these 4 colors, it becomes apparent that the light percentages calculated using the given formula matches the measured values from exercise 1 very well. However, while the formula is hereby verified, the light percent is not as accurate as possible. The reason for this is that the calculated light percent from the sensor is stored as an integer, which does not take decimal numbers into account. This problem can be alleviated either by using 32-bit floating point numbers, or simply by using the raw values directly.
|
|
|
|
... | ... | |