I’ve been doing some experimentation with the Cooking Hack Raspberry Pi to Arduino connection bridge for the upcoming book.
Here is a quick sneak-peak of an experiment I conducted when testing out some of the hardware.
The video below shows a combination of a Raspberry Pi, the Cooking Hacks shield, an Arduino motor-shield a small DC motor and a circuit consisting of a resistor and photo-resistor.
The software in the background is processing the feedback from the photo-resistor and deciding when to turn the motor on and off, and in which direction. This software also generates the necessary PWM for the motor.
In the video I cover the photo-resistor to turn the motor clockwise and then uncover it to turn it counter-clockwise.
P.S Thanks to Andy C on the Cooking Hacks forum for pointing me in the direction of using C threads for PWM.