Phidget: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(No difference)
|
Revision as of 11:05, 2 May 2013
PHIDGET devices
Installation
- Get latest library and example packages
- libphidget_2.1.8.20120131.tar.gz
- phidget21-c-examples_2.1.8.20120131.tar.gz
- configure, make, make install the library package.
- Possible missing of the phidget21.h (had to download it separately).
- During compilation, possible missing declaration, in this case add to the phidget21.h the following declarations:
#include <stdint.h> #define __declspec(x) #define __stdcall #define __int64 uint64_t #define CCONV
Build
- from the examples:
gcc Analog-simple.c -o Analog-simple -pthread -lphidget21
Operation
- In this example, the 4 DACs are available with functions for setting the DAC(voltage) and a channel enable.
CPhidgetAnalog_setVoltage(analog, 0, 1.0); CPhidgetAnalog_setVoltage(analog, 1, 2.0); CPhidgetAnalog_setVoltage(analog, 2, 3.0); CPhidgetAnalog_setVoltage(analog, 3, 4.0); CPhidgetAnalog_setEnabled(analog, 0, PTRUE); CPhidgetAnalog_setEnabled(analog, 1, PTRUE); CPhidgetAnalog_setEnabled(analog, 2, PTRUE); CPhidgetAnalog_setEnabled(analog, 3, PTRUE);
- For other devices, refer to its documentation for the API function list.