Phidget Program Outline

From Phidgets Support
Revision as of 19:31, 28 February 2019 by Jdecoux (talk | contribs) (Created page with "{{Recommended_Flow_Links|{{Flow Page Number|{{PAGENAME}} }} }} right|200px Every Phidget channel you use in any program will fo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 Phidget Programming Basics: Phidget Program OutlineTOC Icon.png Table of Contents

Nav Back Arrow.png Nav Back Hover.png WhiteTab1.png HoverTab1.jpg WhiteTab2.png HoverTab2.jpg GreenTab3.png WhiteTab4.png HoverTab4.jpg WhiteTab5.png HoverTab5.jpg WhiteTab6.png HoverTab6.jpg WhiteTab7.png HoverTab7.jpg WhiteTab8.png HoverTab8.jpg WhiteTab9.png HoverTab9.jpg WhiteTab10.png HoverTab10.jpg WhiteTab11.png HoverTab11.jpg WhiteTab12.png HoverTab12.jpg WhiteTab13.png HoverTab13.jpg WhiteTab14.png HoverTab14.jpg WhiteTab15.png HoverTab15.jpg WhiteTab16.png HoverTab16.jpg Nav Next Arrow.png Nav Next Hover.png


3 . Phidget Program Outline

General Phidget Program Flowchart.png

Every Phidget channel you use in any program will follow the same life cycle:

  1. Create a channel: Make a variable to keep track of your Phidget
  2. Address the channel: Set some basic parameters to indicate which Phidget to connect to.
    • You can specify as much, or as little as you deem necessary. You can even use a Phidget without specifying any parameters, if your system is simple enough.
  3. Open the channel: Opening the channel will begin trying to match a physical Phidget channel to your software channel.
  4. Detect when the channel is attached: Your program must wait until a physical Phidget channel has been attached to your software channel.
    • The attachment process is handled automatically, and will attach to the first available Phidget channel that matches all your specified addressing parameters.
    • A channel is attached when the Phidget libraries link a physical Phidget channel to your software channel.
    • Waiting for attachment can be handled automatically as part of opening the channel or separately, as best suits your program.
  5. Do things with the channel: Send commands to and receive data from your Phidget.
    • This section will encompass the majority of your program. The Phidget API / libraries will make this process as straightforward as possible, and is similar across all types of Phidgets.
  6. Close the channel: Once your program is done, you close the Phidget channel.
    • This frees up the Phidget for the next program that might need it.


For a closer look at the parts of a Phidget program, the following pages will dissect the parts of a Phidget program in more detail. Small code snippets are provided for each step to provide a representation of the code.