-
Notifications
You must be signed in to change notification settings - Fork 20
Tutorial 01 Getting Started
Once you have built your RaspiRobotBoard, you will need to carry out a few tests, to make sure that everything is working. This tutorial leads you through setting up the software that the RaspiRobotBoard needs and using it with the Raspberry Pi. If you are using a newish distribution of Raspbian or Occidentalis, then they may be already installed. Running the commands again will do no harm.
The RaspiRobot library itself requires two other libraries to be installed first, RPi.GPIO and Pyserial. Enter the following commands into a Terminal session on your Raspberry Pi.
>sudo apt-get install python-rpi.gpio
>sudo apt-get install python-serial
The RaspiRobotBoard library itself requires a little bit more effort to install.
On your Raspberry Pi, issue the following commands in a Terminal window:
>wget https://github.com/simonmonk/raspirobotboard/archive/master.zip
>unzip master.zip
>cd raspirobotboard-master
>sudo python setup.py install
Run Some Tests from the Python Console Now that everything is installed, we can experiment with the RaspiRobotBoard.
Open a Python console (Python2 not 3) by typing the following into a Terminal window:
sudo python
Then, within the python console, type the following, one line at a time:
from raspirobotboard import *
rr = RaspiRobot()
rr.set_led1(1)
rr.set_led1(0)
rr.set_led2(1)
rr.set_led2(0)
rr.set_oc1(1)
rr.set_oc1(0)
rr.forward()
rr.left()
rr.right()
rr.stop()
rr.get_range_inch()
rr.sw1_closed()
You can see a video of this here: