Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning Lego Mindstorms EV3

You're reading from  Learning Lego Mindstorms EV3

Product type Book
Published in Jan 2015
Publisher
ISBN-13 9781783985029
Pages 284 pages
Edition 1st Edition
Languages
Author (1):
Gary Garber Gary Garber
Profile icon Gary Garber

Table of Contents (19) Chapters

Learning LEGO MINDSTORMS EV3
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Engineering Notebook Mechanical Design Drive Train and Chassis Sensors and Control Interacting with EV3 Output from EV3 Advanced Programming Advanced Programming and Control Experiment Software and Data Logging Other Programming Languages Communication between Robots Advanced Robot – Gyro Boy Index

Infrared versus Ultrasonic


We are going to start out with a simple program and will gradually add complexity to it. If you are using the Ultrasonic Sensor, it should be plugged into port 4, and this program is on the top line. If you are using the IR sensor, it should be plugged into port 1 and this program is at the bottom line. In this program, the robot moves forward until the Wait block tells it to stop 25 units from a wall or other barrier. You will find that the Ultrasonic Sensor can be set to stop in units of inches or centimeters. The Ultrasonic Sensor emits high-frequency sound waves (above the range of human hearing) and measures the time delay between the emission of the sound waves and when the reflection off an object is measured by the sensor.

In everyday conditions, we can assume that the speed of sound is constant, and thus the Ultrasonic Sensor can give precise distance measurements to the nearest centimeter. As mentioned in Chapter 4, Sensors and Control, using presence...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}