This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| fastdev:phidget_yarp [2009/11/03 11:56] – memeruiz | fastdev:phidget_yarp [2011/11/24 14:20] (current) – memeruiz | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== 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 ~/ | ||
| + | |||
| + | cd local/src | ||
| + | wget http:// | ||
| + | wget http:// | ||
| + | |||
| + | * 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=/ | ||
| + | make | ||
| + | make install | ||
| + | |||
| + | * Install the library | ||
| + | |||
| + | cd ~/local/DIR | ||
| + | xstow libphidget-2.1.8.20111121 | ||
| + | |||
| + | |||
| + | ===== Phidgets python bindings ===== | ||
| + | |||
| + | * Precompile and install the bindings | ||
| + | |||
| + | cd ~/ | ||
| + | python setup.py install --prefix=/ | ||
| + | cd ~/ | ||
| + | xstow phidgetspython | ||
| + | |||
| + | ===== Giving permissions to users to use the phidgets hardware ===== | ||
| + | |||
| + | cd ~/ | ||
| + | sudo cp 99-phidgets.rules / | ||
| + | / | ||
| + | |||
| + | * 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," | ||
| + | |||
| + | * 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: | ||
| + | |||
| + | [[http:// | ||