Programming PiRoCon in Python

Python

We have created a python library that makes programming PiRoCon and Initio very simple.

If you are using the PiRoCon on a different robot, you may need to change some of the pin assignments used, but the code itself should be fine

Raspberry Pi Python examples can be downloaded from an LXterminal session and connected to the internet, type in or copy and paste:

wget http://4tronix.co.uk/initio.sh -O initio.sh

Then type in:

bash initio.sh

You will then have a number of python examples to try. Run them with

sudo python filename.py
  • motorTest2.py:  use the arrow keys to move forwards and backwards, spin left or spin right. Space to stop. Use . and , to increase or decrease speed
  • sonarTest.py: Prints the distance in centimetres from the ultrasonic sensor, once every second
  • irTest.py: Prints the state of the IR line and obstacles sensors, every time the state changes.
  • servoTest.py:  use the arrow keys to pan and tilt