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
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Raspberry Pi Robotic Projects

You're reading from   Raspberry Pi Robotic Projects Work through a mix of amazing robotic projects using the Raspberry Pi Zero or the Raspberry Pi 3

Arrow left icon
Product type Paperback
Published in Oct 2016
Publisher
ISBN-13 9781786467966
Length 238 pages
Edition 3rd Edition
Languages
Concepts
Arrow right icon
Authors (2):
Arrow left icon
Jon Witts Jon Witts
Author Profile Icon Jon Witts
Jon Witts
Richard Grimmett Richard Grimmett
Author Profile Icon Richard Grimmett
Richard Grimmett
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Raspberry Pi Robotic Projects - Third Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
1. Getting Started with the Raspberry Pi FREE CHAPTER 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 R2D2 using the Raspberry Pi in Python


The hardware is ready; now you can access all this functionality from the Raspberry Pi. First, install the library associated with the control board, found at http://www.monkmakes.com/rrb3/. Perform the following steps:

  1. Type cd ~.

  2. Run the command git clone https://github.com/simonmonk/raspirobotboard3.git —this will retrieve the library.

  3. Then type cd raspirobotboard3/python to go to the raspirobotboard3/python directory.

  4. Type sudo python setup.py install—this will install the files.

  5. Now you'll create some Python code that will allow you to access both the DC motor to turn the top and/or light the LED. Here is that code:

#!/usr/bin/python 
import time 
import RPi.GPIO as io 
from rrb3 import * 
 
io.setmode(io.BCM) 
 
forward_pin = 27 
backward_pin = 22 
led1 = 24 
led2 = 23 
 
def forward(): 
    io.output(forward_pin, True) 
    io.output(backward_pin, False) 
 
...
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