
Programming a menu. Storing in Arrays. WRO Elementary 2013.
The challenge for this video is to program a menu that is controlled from the LEGO Mindstorms EV3 brick screen.
- #220
- 17 Jul 2016
The challenge for this video is to program a menu that is controlled from the LEGO Mindstorms EV3 brick screen.
The robot works on the field and decodes the different colours that represent the rows and the columns.
After we have introduced a menu in the previous video, this video focuses on storing the values in an array. It presents a basic use of arrays.
We would continue from the previous program where we used variables and we would change this to arrays.
One of the smartest things you could do in any software program is to extract logic in small reusable, simple, understandable units. In EV3-G these are called Blocks and we are going to extract the logic for finding a minimum and maximum for each of the sensors in a new block.
A common question is how to display arrays on the LEGO Mindstorms EV3 brick screen. Displaying values from an array is not different from any other display operation. In this tutorial, we would look at displaying two specific values. The minimum and the maximum for a specific sensor from the Advance Calibration Course Section
In this tutorial, we show you how to display all the values from an EV3-G array on the EV3 brick display. We are using an array Read Operation along with a loop. We are also detecting the loop counter and using it as an index to an array. It's basically the only viable way to do it. The process is commonly referred to as - "Iteration over an array" (although we still do not have an iterator in the programming language, we promise that one day we would do the super advance videos on "iteration" using the LEGO MINDSTORMS robots")
Following the Advance Sensor Calibration course section, we found the min and max values detected by each sensor. Now it is time for the real deal of the calibration. Detect the current value from the sensor and find what is the percentage of this value for the range between min and max.