Controlling the DC motors
To control the DC motors from the Raspberry Pi, you'll first want to install the libraries. Here are the steps to do so:
cd ~
: Go to the home directory.git clone https://github.com/simonmonk/raspirobotboard3.git
: This command will get the library.cd raspirobotboard3/python
: Go to the directory that has the installed files.sudo python setup.py install
: Install the Python library.
Once these are installed, you can write this simple program to make the wheels go forward:
#!/usr/bin/python from rrb3 import * import time rr = RRB3(11, 11) rr.set_motors(0.5, 0, 0.5, 0) time.sleep(1) rr.set_motors(0, 0, 0, 0)
This should make the wheels go forward at half the speed. You can add a bit of code to check full speed and forward and backward:
#!/usr/bin/python from rrb3 import * import time rr = RRB3(11, 11) rr.set_motors(1, 0, 1, 0) time.sleep(1) rr.set_motors(0.5, 0, 0.5, 0) time.sleep(1)...