... | @@ -69,14 +69,14 @@ The following four graphs show the data collected from using 10ms, 50ms, 100ms a |
... | @@ -69,14 +69,14 @@ The following four graphs show the data collected from using 10ms, 50ms, 100ms a |
|
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.
|
|
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.
|
|
|
|
|
|
### Exercise 6
|
|
### Exercise 6
|
|
We tried to use text strings directly in the calls to LCD.drawString instead of the variables right and left. We used Runtime.getRuntime().freeMemory() to store the amount of free memory on the heap during the execution using the variables and during the execution using strings directly. This gave us the following two graphs.
|
|
We tried to use text strings directly in the calls to ```LCD.drawString``` instead of the variables right and left. We used ```Runtime.getRuntime().freeMemory()``` to store the amount of free memory on the heap during the execution using the variables and during the execution using strings directly. This gave us the following two graphs.
|
|
|
|
|
|
![Alt attribute text Here](images/ex6_mem_var.png)
|
|
![Alt attribute text Here](images/ex6_mem_var.png)
|
|
|
|
|
|
![Alt attribute text Here](images/ex6_mem_var.png)
|
|
![Alt attribute text Here](images/ex6_mem.png)
|
|
|
|
|
|
Here we see how the heap gets filled during the executions and is cleared when the amout of free memory is less than 40,000.
|
|
Here we see how the heap gets filled during the executions and is cleared when the amout of free memory is less than 40,000.
|
|
We see how the heap is filled faster when executing the program using strings directly, compared to the program that uses variables. This indicates that the program does not have a direct reference the the strings if not stored in a variable, and therefore allocates space on the heap for the strings each time they are used.
|
|
We see how the heap is filled faster when executing the program using strings directly, compared to the program that uses variables. This indicates that the program does not have a direct reference to the strings if not stored in a variable, and therefore allocates space on the heap for the strings each time they are used.
|
|
|
|
|
|
## Conclusion
|
|
## Conclusion
|
|
In conclusion, we have solved the 6 exercies we set out to do. Overall, we have gained knowledge of our first proportional-control program, and have gained insight in how the light sensor module for the nxt works.
|
|
In conclusion, we have solved the 6 exercies we set out to do. Overall, we have gained knowledge of our first proportional-control program, and have gained insight in how the light sensor module for the nxt works.
|
... | | ... | |