Skip to Main Content
Raspberry Pi Essentials
book

Raspberry Pi Essentials

by Jack Creasey
April 2015
Beginner content levelBeginner
212 pages
4h 47m
English
Packt Publishing
Content preview from Raspberry Pi Essentials

Project 1 – Python control of a PWM board driving RC servo motors

You should now have a reasonable understanding of what is required to program an I2C PWM board, so let's look at some Python code to drive the Adafruit 16 channel PWM board.

Note

The python-smbus library is compatible only with Python 2 at the time of writing. To run PCA9685, you have to use IDLE and not IDLE3. To run from the command line, use Python and not Python 3. As with the RPi-GPIO library, the SMBus library needs to have root privileges.

First, create a new /home/pi/servo project directory for the files and download pca9685.py from the Chapter 6 folder at http://1drv.ms/1ysAxkl into the directory.

Then, open the pca9685.py file in the idle development environment, remembering ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Raspberry Pi Zero W Wireless Projects

Raspberry Pi Zero W Wireless Projects

Vasilis Tzivaras
Raspberry Pi Hacks

Raspberry Pi Hacks

Ruth Suehle, Tom Callaway

Publisher Resources

ISBN: 9781784396398Supplemental Content