Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Internet of Things with Arduino Cookbook

You're reading from  Internet of Things with Arduino Cookbook

Product type Book
Published in Sep 2016
Publisher Packt
ISBN-13 9781785286582
Pages 188 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Marco Schwartz Marco Schwartz
Profile icon Marco Schwartz

Table of Contents (14) Chapters

Internet of Things with Arduino Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
1. Connecting an Arduino to the Web 2. Cloud Data Monitoring 3. Interacting with Web Services 4. Machine-to-Machine Interactions 5. Home Automation Projects 6. Fun Internet of Things Projects 7. Mobile Robot Applications Index

Configuring your mobile robot


In this recipe, we are simply going to make sure that the robot we assembled is working correctly, by testing the motors of the robot. This will allow us to be sure that everything is working later when it comes to writing more complex sketches to control the robot.

Getting ready

Here, you simply need to make sure that you followed the previous recipe to assemble the robot. Also make sure that the batteries are fully charged, and that the robot's wheels or tracks are not touching the ground, as we simply want to test the motors here.

How to do it...

We are now going to build a sketch to test the motors of the robot. As a test, we'll make the robot go forward, and then stop, and repeat the process.

First, we define which pins the L293D chip is connected to on the Arduino board:

// Define motor pins
int motorOnePlus = 6;
int motorOneMinus = 7;
int motorOneEnable = 5;

int motorTwoPlus = 8;
int motorTwoMinus = 9;
int motorTwoEnable = 4;

After that, in the setup() function...

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}