O'Reilly logo

Raspberry Pi Robotic Projects - Third Edition by Richard Grimmett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required