Notice: This page contains information for the legacy Phidget21 Library. Phidget21 is out of support. Bugfixes may be considered on a case by case basis. Phidget21 does not support VINT Phidgets, or new USB Phidgets released after 2020. We maintain a selection of legacy devices for sale that are supported in Phidget21. We recommend that new projects be developed against the Phidget22 Library.
|
Template:UsingAPhidgetInCodeSpecific
Phidgets’ philosophy is that you do not have to be an electrical engineer in order to do projects that use devices like sensors, motors, motor controllers, and interface boards. All you need to know is how to program.
If this is your first time working with a Phidget, we suggest you start with the [[{{{1}}}|Getting Started]] for the {{{2}}}. The process which begins there will walk you through:
- Installing drivers and libraries
- Choosing a programming language
- Reading about General Phidget Programming, and
- Getting code examples for your language
Use those pages to download the examples and learn about the framework in which to develop your own code. You will be referred back here to refer to the specific functions and example layout for the {{{2}}}.
This device-specific API section is deliberately generic. It provides a list of functions available only to the {{{2}}} software object. To get information on what a device-specific function does, you're in the right place. To get specific syntax for that function within your programming language, you'll want the API document from your programming language page.
There are also a handful of functions common to all Phidgets (open, close, etc). If you are looking for a list of these common functions, you can find them on the API document for your your specific programming language. Help and in-depth information on using these common functions can be found on the General Phidget Programming page.
{{{3}}} {{{2}}} Object
In your code, you should create and use a {{{6}}} object to use the functionality of this board.
In C, for example, this would be the set of {{{4}}}
functions, or in Java it would be the {{{5}}}
class.
Check the complete API for your programming language to find the specific syntax for the object and the calls below.
{{{3}}} {{{2}}} Code Examples
Examples for the {{{2}}} - as well as a general HelloWorld example - can be found for most of our supported languages.
Visit the page for your language to get the actual examples, and the API document for that language with specific syntax. For a high-level view of the functions you can use on the {{{2}}}, read on.