Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
BeagleBone Robotic Projects

You're reading from   BeagleBone Robotic Projects Build and control robots that walk, swim, roll, and fly

Arrow left icon
Product type Paperback
Published in Jun 2017
Publisher Packt
ISBN-13 9781788293136
Length 230 pages
Edition 2nd Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Richard Grimmett Richard Grimmett
Author Profile Icon Richard Grimmett
Richard Grimmett
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Getting Started with the BeagleBone Blue FREE CHAPTER 2. Programming the BeagleBone Blue 3. Making the Unit Mobile - Controlling Wheeled Movement 4. Avoiding Obstacles Using Sensors 5. Allowing Our BeagleBone Blue to See 6. Providing Speech Input and Output 7. Making the Unit Very Mobile - Controlling Legged Movement 8. Using a GPS Receiver to Locate Your Robot 9. By Land, By Sea, By Air 10. System Dynamics

Creating an array of sensors

To do this, connect the additional pins, as follows:

Arduino pin Sensor pin
5V Sensor 1 VCC
GND Sensor 1 GND
12 Sensor 1 Trig
11 Sensor 1 Echo
5V Sensor 2 VCC
GND Sensor 2 GND
10 Sensor 2 Trig
9 Sensor 2 Echo
5V Sensor 3 VCC
GND Sensor 3 GND
8 Sensor 3 Trig
7 Sensor 3 Echo

Here is a picture of the three sensors assembled:

Now that the sensors are connected, you'll need to add some functionality to the Arduino code to communicate with all three sensors. Here is that Arduino code:

    #include <NewPing.h>
#define TRIGGER_PIN1 12
#define ECHO_PIN1 11
#define TRIGGER_PIN2 10#define ECHO_PIN2 9
#define TRIGGER_PIN3 8
#define ECHO_PIN3 7
#define MAX_DISTANCE 200
NewPing sonar1(TRIGGER_PIN1, ECHO_PIN1, MAX_DISTANCE);
NewPing sonar2(TRIGGER_PIN2, ECHO_PIN2, MAX_DISTANCE);
NewPing sonar3(TRIGGER_PIN3...
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 $19.99/month. Cancel anytime
Banner background image