Phidgets software

The phidgets software consist of 1) a C library to comunicate with the hardware and 2) the python bindings that uses this library. Here are the installation instructions.

Phidgets C library

  • Download the software inside of your home directory in ~/local/src:
cd local/src
wget http://www.phidgets.com/downloads/libraries/libphidget_2.1.8.20111121.tar.gz
wget http://www.phidgets.com/downloads/libraries/PhidgetsPython_2.1.8.20111121.zip
  • Un compress the files
tar -xzf libphidget_2.1.8.20111121.tar.gz
unzip PhidgetsPython_2.1.8.20111121.zip
  • Configure and compile the C phidgets library
cd libphidget-2.1.8.20111121/
./configure --prefix=/home/replace_with_your_user/local/DIR/libphidget-2.1.8.20111121/
make
make install
  • Install the library
cd ~/local/DIR
xstow libphidget-2.1.8.20111121

Phidgets python bindings

  • Precompile and install the bindings
cd ~/local/src/PhidgetsPython/
python setup.py install --prefix=/home/replace_with_your_user/local/DIR/phidgetspython
cd ~/local/DIR/
xstow phidgetspython

Giving permissions to users to use the phidgets hardware

cd ~/local/src/libphidget-2.1.8.20111121/udev/
sudo cp 99-phidgets.rules /etc/udev/rules.d/
/etc/init.d/udev restart
  • In this moment disconect and connects the phidgets back
Download the Python examples
  • Get the examples from the phidgets webpage and uncompress it.
  • Connect a phidgets interface kit and run:
python InterfaceKit-simple.py
Small example
  • Plug the interface kit to the usb port of your computer. Then plug a phidget to the analog input 0.
  • Run the following commands inside of ipython
from Phidgets.PhidgetException import *
from Phidgets.Events.Events import *
from Phidgets.Devices import *
ik=InterfaceKit.InterfaceKit()
ik.openPhidget()
ik.waitForAttach(10000)
print ik.getSensorValue(0)
  • This should read and show the value from analog input 0
lcd=TextLCD.TextLCD()
lcd.openPhidget()
lcd.waitForAttach(0)
lcd.setDisplayString(0,"hello world") 
  • This should show “hello world” in the LCD display
  • For correctly closing the devices
ik.closePhidget()
lcd.closePhidget()

For help, check the examples, as well as the Python API documentation:

here

 
fastdev/phidget_yarp.txt · Last modified: 2011/11/24 14:20 by memeruiz · [Old revisions]
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki