Raspberry Pi 3 Cookbook for Python Programmers - Third Edition
by Steven Lawrence Fernandes, Tim Cox
Using I/O expanders
As we saw previously (in Chapter 10, Sensing and Displaying Real-World Data), wiringpi2 allows us to easily adjust our code to make use of I/O expanders using I2C. In this case, it can be useful to add additional circuits, such as sensors and LED status indicators, and perhaps even displays and control buttons, to assist with debugging and controlling the Rover-Pi robot as you develop it.
It can be particularly helpful if you intend to use it as a tethered device, since you will only require three wires to connect back to the Raspberry Pi (I2C Data GPIO Pin 3, I2C Clock GPIO Pin 5, and Ground GPIO Pin 6), with I2C VCC being provided by the motor controller 5V output.
As shown in the earlier example, add defines for the ...
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.
Read now
Unlock full access