Once the library has installed, we can start up a Python command line and try a few commands to get the motors running. Type the following command to start an Interactive Python session.
from rrb2 import * rr = RRB2() rr.forward()
If you have a very old revision 1 model B Raspberry Pi then change the second line to: rr = RRB2(revision=1)
To stop the motors again, enter the following line:
rr.stop()
To set the motors running forward for 5 seconds, use the command:
rr.forward(5)
To set the motors running forward at half speed enter the following command:
rr.forward(0, 0.5)
As well as forward try experimenting with the commands reverse, left and right, which work in just the same way as forward.
Page last edited September 19, 2014
Text editor powered by tinymce.