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

Push buttons


From the LEGO MINDSTORMS EV3 Help, you may be familiar with using Brick Buttons to start or stop an action. For instance, in the following program, the robot will move until a Brick Button is pushed.

Using the Brick Buttons to enter information will take some advanced programming and involve variables, case structures, and loops. Using the Brick Buttons on the EV3 brick, we are going to select the value for the speed of the robot. We are going to write a program that has a Switch block and a Loop to select the speed.

The program will begin by prompting the user with text displayed to the EV3 brick screen. To control how fast the robot moves, we will use a variable called Speed. The program then enters a loop to register each press of the Brick Buttons. When the loop is terminated, the updated value of the variable will be sent to a motor command.

First, we need to display commands for the user on the EV3 screen. Most of the first row of this program is used to send text to the...