How it works...

We explain the previous script functions by exploring how the servos are controlled using a PWM. Next, we will see how the servo class provides the methods to control the PCA9685 device. Finally, we will look at how the movements of the three servos combine to produce forward and turning motions for the Pi-Bug robot itself.

Get Raspberry Pi 3 Cookbook for Python Programmers - 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.