Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Raspberry Pi Robotic Projects - Third Edition

You're reading from  Raspberry Pi Robotic Projects - Third Edition

Product type Book
Published in Oct 2016
Publisher
ISBN-13 9781786467966
Pages 238 pages
Edition 3rd Edition
Languages
Concepts
Authors (2):
Richard Grimmett Richard Grimmett
Profile icon Richard Grimmett
Jon Witts Jon Witts
Profile icon Jon Witts
View More author details

Table of Contents (13) Chapters

Raspberry Pi Robotic Projects - Third Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
1. Getting Started with the Raspberry Pi 2. Building Your Own Futuristic Robot 3. Building a Wall-E Robot 4. Building a Robotic Fish 5. Creating a Robotic Hand with the Raspberry Pi 6. A Self-Balancing Robot 7. Adding the Raspberry Pi to a Quadcopter

Controlling the DC motors


To control the DC motors from the Raspberry Pi, you'll first want to install the libraries. Here are the steps to do so:

  1. cd ~: Go to the home directory.

  2. git clone https://github.com/simonmonk/raspirobotboard3.git : This command will get the library.

  3. cd raspirobotboard3/python: Go to the directory that has the installed files.

  4. sudo python setup.py install: Install the Python library.

Once these are installed, you can write this simple program to make the wheels go forward:

#!/usr/bin/python 
from rrb3 import * 
import time 
rr = RRB3(11, 11) 
rr.set_motors(0.5, 0, 0.5, 0) 
time.sleep(1) 
rr.set_motors(0, 0, 0, 0) 

This should make the wheels go forward at half the speed. You can add a bit of code to check full speed and forward and backward:

#!/usr/bin/python 
from rrb3 import * 
import time 
rr = RRB3(11, 11) 
rr.set_motors(1, 0, 1, 0) 
time.sleep(1) 
rr.set_motors(0.5, 0, 0.5, 0) 
time.sleep(1)...
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}