What is a Phidget?: Difference between revisions

From Phidgets Support
No edit summary
No edit summary
Line 82: Line 82:
|'''Core Languages''' || |'''Mobile Languages''' || |'''Other Languages'''
|'''Core Languages''' || |'''Mobile Languages''' || |'''Other Languages'''
|-
|-
|[[Image:Icon-CSharp.png|alt=C Sharp|24x24px|link=Language - C Sharp]] [[Language - C Sharp|C#]] || [[Image:Icon-Android.png|alt=Android Java|24x24px|link=Language - Android Java]] [[Language - Android Java|Android Java]] || [[Image:Icon-LabVIEW.png|alt=LabVIEW|24x24px|link=Language - LabVIEW]] [[Language - LabVIEW|LabVIEW]]  
|[[Image:Icon-CSharp.png|alt=C Sharp|24x24px|link=Language - C Sharp]] [[Language - C Sharp|C#]] || [[Image:Icon-ObjC.png|24x24px|alt=Objective C|link=Language - Objective C]] [[Language - Objective C|Objective C]] || [[Image:Icon-LabVIEW.png|alt=LabVIEW|24x24px|link=Language - LabVIEW]] [[Language - LabVIEW|LabVIEW]]
|-
|-
|[[Image:Icon-C++.png|alt=C/C++|24x24px|link=Language - C/C++]] [[Language - C/C++|C/C++]] || |[[Image:Icon-iOS.png|alt=iOS|24x24px|link=Language - iOS]] [[Language - iOS|iOS]] || |[[Image:Icon-MaxMSP.png|24x24px|alt=Max/MSP|link=Language - Max/MSP]] [[Language - Max/MSP|Max/MSP]]
|[[Image:Icon-C++.png|alt=C/C++|24x24px|link=Language - C/C++]] [[Language - C/C++|C/C++]] || |[[Image:Icon-Swift.png|alt=Swift|24x24px|link=Language - Swift]] [[Language - Swift|Swift]] || |[[Image:Icon-MaxMSP.png|24x24px|alt=Max/MSP|link=Language - Max/MSP]] [[Language - Max/MSP|Max/MSP]]
|-
|-
|[[Image:Icon-Python.png|alt=Python|24x24px|link=Language - Python]] [[Language - Python|Python]]  
|[[Image:Icon-Python.png|alt=Python|24x24px|link=Language - Python]] [[Language - Python|Python]]
|-
|-
|[[Image:Icon-Java.png|alt=Java|24x24px|link=Language - Java]] [[Language - Java|Java]]  
|[[Image:Icon-Java.png|alt=Java|24x24px|link=Language - Java]] [[Language - Java|Java]]  
Line 92: Line 92:
|[[Image:Icon-Visual Basic Net.png|alt=Visual Basic .NET|24x24px|link=Language - Visual Basic .NET]] [[Language - Visual Basic .NET|Visual Basic .NET]]
|[[Image:Icon-Visual Basic Net.png|alt=Visual Basic .NET|24x24px|link=Language - Visual Basic .NET]] [[Language - Visual Basic .NET|Visual Basic .NET]]
|-
|-
|[[Image:Icon-Cocoa.png|alt=Cocoa|24x24px|link=Language - Cocoa]] [[Language - Cocoa|Cocoa]]  
|[[Image:Icon-Javascript.png|alt=JavaScript|24x24px|link=Language - JavaScript]] [[Language - JavaScript|JavaScript]]  
|-
|-
|}
|}

Revision as of 17:50, 18 April 2017

Phidgets are building-block tools for sensing and control from a computer, tablet, or smartphone.

In the programming language of your choice, you create applications that use Phidgets to interact with the physical world.

Phidgets connect to a USB port of a computer:

File:Wiap-image1.png


Some Phidgets are a complete, self-contained sensing package.

One example is our Spatial, which measures motion:

File:Wiap-image2-spatial.png

Or, a Phidget may be a building block to use other sensors.

One example is our Temperature Sensor, which allows use of wire thermocouples:

File:Wiap-image2-temp.png

Or, a Phidget may be a flexible I/O (input/output) board which can record and control analog sensors and digital inputs and outputs.

One example is our Interface Kit 8/8/8, with eight ports of each type:

Last but not least, a Phidget may be a VINT Hub, whose versatile ports can be used as inputs or outputs, and can also connect to smart VINT devices.

File:Wiap-vint.png

Other Phidgets are our:

  • Analog sensors, which plug into our I/O boards,
  • VINT Devices
  • Motors, switches, LEDs, and other components,
  • Single Board Computer - a complete embedded computer, plus Phidget I/O.


Data and control flows up and down the USB connection:

File:Wiap-image3.pngFile:Wiap-vintFlow.png

You can use more than one Phidget at a time to control motors, measure motion, and much, much more. You can also use multiple sensors, inputs, and outputs on our I/O boards.

Combining these abilities lets you build extensive systems that can sense the environment and react to it.


Using Phidgets means writing code. Within your code, you can create a software object to access our full Phidget library API to access each type of Phidget and use its functions.

The software object sends and receives data to and from the Phidget:

File:Wiap-image4.png

The software object might be a VoltageInput() for the sensors attached to an Interface Kit, or a RFID() for an RFID reader, for example.


We provide support for many different languages to program in:

Core Languages Mobile Languages Other Languages
C Sharp C# Objective C Objective C LabVIEW LabVIEW
C/C++ C/C++ Swift Swift Max/MSP Max/MSP
Python Python
Java Java
Visual Basic .NET Visual Basic .NET
JavaScript JavaScript

You can visit the Software Overview page for more information on the supported programming languages.


Writing code for your Phidget can be as simple as creating a handle, opening it, getting a sensor value, and printing it.

A simple, stripped-down program in C to read the the value of a sensor connected to an Interface Kit might look like this:

#include <stdio.h>
#include <phidget22.h>

int main(int argc, char* argv[]) {
    // A "VoltageInput" Phidget Handle; the name we use to access properties and methods of the Phidget
    PhidgetVoltageInputHandle voltageInput;

    // Our Sensor Reading
    int sensorValue;

    // Create a new VoltageInput object
    PhidgetVoltageInput_create(&voltageInput);
    
    // Set the channel to the port the sensor is plugged into on the InterfaceKit
    Phidget_setChannel((PhidgetHandle)voltageInput, 0);

    // Open and attach the Phidget
    Phidget_openWaitForAttachment((PhidgetHandle)voltageInput, 5000);

    // Read Sensor on Port 0
    PhidgetVoltageInput_getvoltage(voltageInput, &sensorValue);

    printf("Hello World!  My Port 0 sensor reads %d.\n", sensorValue);

    // Close and clean up
    Phidget_close((PhidgetHandle)voltageInput);
    PhidgetVoltageInput_delete(&voltageInput);
    return 0;
}


The Phidget library includes powerful logging and error checking not shown in this brief program. To see some full-featured example programs, check the downloads section for the language of your choice.


Our software libraries are modular. A VoltageInput software object, for example, has functions you can use to control and read the Voltage Input, such as setting the data interval or reading the voltage:



The API for each Phidget contains multiple of these objects. For example, the 1018 Phidget InterfaceKit uses five distinct objects:



The Phidget Common object contains basic functions like open() and close() and is used by every Phidget. It's the same no matter what Phidget you're using. The other objects will also contain largely the same functions, properties, and events across different Phidgets, although there may be minor differences which are explained in the API manual. For example, the 1024 PhidgetRFID Read/Write has a DigitalOutput object which is just like the one for the 1018 Phidget InterfaceKit:




Not only can you control a Phidget locally, but we also provide a tool called the Phidget WebService.

The WebService allows you to control a Phidget over your local network:

This allows your to use more than one computer, or even a smartphone:

File:Webservice general pctoandroid.png

The WebService also includes the Phidget Dictionary, which is a central place to store your data in a distributed application.


Your Phidgets program can run under any of the major operating systems. With the WebService, you can even use operating systems that don't normally have USB ports, such as Android and IOS:

Desktop OSes Mobile/Wireless OSes
OS - WindowsWindows OS - Phidget SBCPhidget SBC
OS - OS XOS X OS - AndroidAndroid
OS - LinuxLinux OS - iOSiOS

With the WebService, you can even mix and match multiple operating systems to control one Phidget. For example, you could connect your Phidgets to a PhidgetSBC running Linux, and control it over the WebService using an Android tablet.


The Phidget Library gives the option of using software events, rather than just reading values.

With events, you can let the data come to you as it changes:

This allows clean integration with GUI programs, which are usually already event-driven.


The library also includes support for using (and distinguishing between) more than one Phidget in your code - even the same type of Phidget.

This is usually done by reference to the unique serial number of each Phidget, as here in a Python code example:

There are other ways to do this, such as setting your own labels, or using our Phidget Manager to detect attached Phidgets.


With the combination of events, modular sensors, and network support, your system can range from simple to incredibly complex.

We encourage customers to not only build projects for themselves, but also to design and build real-world products using Phidgets. Our libraries can be distributed with your code to your customers.

And this can all occur with the same devices, and the same flexible software API.

Want to learn more? Check out our:

Questions? Please contact us.