Alert.png

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.


Click on the 2phidget22.jpg button in the menu bar to go to the Phidget22 version of this page.

Alert.png

Template:ExamplePseudocodeLogic: Difference between revisions

From Phidgets Legacy Support
No edit summary
No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
You can learn about the flow and the functions within the examples by reading about [[General Phidget Programming]], which will walk you through the concepts in each example, regardless of your device or language.
The examples for each device all have this general structure so you can follow along.  We also have [[General Phidget Programming|an in-depth general introduction]] to writing Phidget code (like open, read data, etc), as well as the {{{2}}} for specific syntax:


The examples for each device all have this general structure so you can follow along:
<div class="source">
<font size="2">
{| style="margin-left:15px;"


<div style="background-color: #f3f3f3; border-color: #1c9edb; border-width:1px; border-style: dashed;">
|- valign="top"
<font size="3">
|style=white-space:nowrap|<font face="courier new" family="monospace">
<source lang=cpp>


  Create Device Software Object
<span style="color:#090;">// ----- '''Main''' Code -----</span>
  Open Device
  Wait until Device Attachment
  Initialize any hardware (antennas, etc)


  Loop waiting on requests from user input:
'''Create''' Device Software Object<br>
      Get and Print various device statuses on request by input
'''Open''' Device<br>
      Exit upon specific user input
Wait until Device '''Attachment'''<br>
'''Initialize''' any hardware (antennas, etc)


  Close Device
;Loop waiting on requests from user input
  Delete Device
:Get and Print various device statuses on request by input
:Exit upon specific user input


</source>
'''Close''' Device<br>
Delete Device
 
</font>
| width="15px" | &nbsp;
|
<font face="courier new" family="monospace">
<span style="color:#00F;">{{{1}}}</span>
</font>
|}
</font>
</font>
</div>
</div>

Latest revision as of 20:01, 27 January 2012

The examples for each device all have this general structure so you can follow along. We also have an in-depth general introduction to writing Phidget code (like open, read data, etc), as well as the {{{2}}} for specific syntax:

// ----- Main Code -----

Create Device Software Object
Open Device
Wait until Device Attachment
Initialize any hardware (antennas, etc)

Loop waiting on requests from user input
Get and Print various device statuses on request by input
Exit upon specific user input

Close Device
Delete Device

 

{{{1}}}