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

Brick lights


Brick lights are another useful way to provide visual feedback from your robot. Coordinating the color of the brick with other parts of your program can be interesting. In the following code, the color of the brick is dependent on the value of the Color Sensor. If the Color Sensor detects black, the brick will be orange. If the Color Sensor detects white, the brick will glow green. Otherwise, by default, if the sensor detects anything other than black or white, the brick will glow red, as shown in the following screenshot:

This allows for a cool-looking EV3 brick, and allows your robot to visually display information that can be seen from a distance. You may want to have lights that are not built into your EV3 brick. In order to use off-brick lights, you will need to use some of the legacy NXT MINDSTORMS parts.