... | @@ -76,7 +76,14 @@ Sample interval 1000: |
... | @@ -76,7 +76,14 @@ Sample interval 1000: |
|
### Exercise 5
|
|
### Exercise 5
|
|
In this exercise we use SensorPorttest.java. We change the code to experiment with the formula that describes the relationship between the light percent and the raw values.
|
|
In this exercise we use SensorPorttest.java. We change the code to experiment with the formula that describes the relationship between the light percent and the raw values.
|
|
|
|
|
|
|
|
Looking at the previous percentage values from exercise 1 and compares them too the RAW values, we see that that the formula always rounds down the percentage, even though it should be rounded up. However, the values is still within an acceptable area.
|
|
|
|
|
|
|
|
Black: raw vlaue: 683 calculated: 0,3323558162 in percent: 33,23558162% Før 36%
|
|
|
|
|
|
|
|
White: raw value: 490 calculated: 0,5210166178 in percent: 52,10166178% Før 56%
|
|
|
|
|
|
|
|
Could there be a reason for using the raw values instead of the light percent?
|
|
|
|
By using the light percent formula you lose a lot of decimals, so one could say that the RAW values would give you a more precise feedback eg. differ colors from each other. So if you only have to differ from black and white it is enough to only use the light percentage formula.
|
|
|
|
|
|
### Exercise 6
|
|
### Exercise 6
|
|
In this exercise we try to use text strings in the calls to LCD.drawString instead of the variables right and left and use Runtime.getRuntime().freeMemory() to display the amount of free memory on the heap during the execution.
|
|
In this exercise we try to use text strings in the calls to LCD.drawString instead of the variables right and left and use Runtime.getRuntime().freeMemory() to display the amount of free memory on the heap during the execution.
|
... | | ... | |