Display data

A very simple example of useful code would be to display a time counter on the screen. To do this, you wire the output from a Timer sensor block to the wired input of the Display block. You will want to erase the screen whenever the new time value is displayed.

Display data

At the same time, you can display the value of a sensor on the same screen. In the following screenshot, the value for the Color Sensor will be displayed on the screen. You can choose the x and y coordinates of the text, and I have the sensor value displayed just below the time. Additionally, the screen is erased only during the first Display block. When you click on the Mode Selector for the Display block, there are actually two text modes, Grid and Pixels. In the following screenshot, I have used Text Grid and the program writes the sensor values to row 3 on the Display screen. Each row in the grid is actually 10 pixels high.

Display data

As you saw in Chapter 5, Interacting with EV3, we can also display the value of a variable. In the next program, I have added a parallel sequence where the screen displays the number of times a Touch Sensor has been pushed. There is a half-second delay in the loop so you can record discrete touches. This delay will prevent the program from adding to the value of the variable touches continuously while the Touch Sensor is pushed.

Display data
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.183.172