Book Image

Learning Lego Mindstorms EV3

By : Gary Garber
Book Image

Learning Lego Mindstorms EV3

By: Gary Garber

Overview of this book

Table of Contents (19 chapters)
Learning LEGO MINDSTORMS EV3
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
10
Other Programming Languages
Index

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.

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.

As you saw in Chapter 5, Interacting with EV3, we can also display the value of a variable. In...