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:
- Type
cd ~
. - Run the command
git clone
https://github.com/simonmonk/raspirobotboard3.git
—this will retrieve the library. - Then type
cd raspirobotboard3/python
to go to theraspirobotboard3/python
directory. - Type
sudo python setup.py install
—this will install the files. - 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) ...
Get Raspberry Pi Robotic Projects - Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.