Page 97 - Programming the Raspberry Pi Getting Started with Python
P. 97
Figure 9-8 The Humble Pi
Arduino and the Pi
Although the Raspberry Pi can be used like a microcontroller to drive motors and such, this is not
really what it was designed for. As such, the GPIO pins cannot supply much in the way of drive
current and are somewhat delicate and intolerant of electrical abuse. This is, after all, the motivation
for the expansion boards described in the previous section.
Arduino boards, on the other hand, are much more rugged and designed to be used to control
electronic devices (see Figure 9-9). What is more, they have analog inputs that can measure a voltage
from, say, a temperature sensor.
Figure 9-9 An Arduino board connected to a Raspberry Pi
Arduino boards are designed to allow communication with a host computer using USB, and there is
no reason why this host shouldn’t be a Raspberry Pi. This means that the Arduino takes care of all the
electronics and the Raspberry Pi sends it commands or listens for incoming requests from the
Arduino.
If you have an Arduino, you can try out the following simple example, which allows you to send
messages to the Arduino to blink its build-in LED on and off while at the same time receiving
incoming messages from the Arduino. Once you can do that, it is easy to adapt either the Arduino