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:ExamplePseudocode: Difference between revisions
No edit summary |
No edit summary |
||
(15 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
The Hello World example has 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 {{{3}}} for specific syntax: | |||
<div class="source"> | |||
{| class="source" style="margin-left:15px;" | |||
<div | |||
|- valign="top" | |- valign="top" | ||
|<font face="courier new" family="monospace"> | |<font face="courier new" family="monospace"> | ||
<span style="color:#090;">// ----- Event Functions -----</span> | <span style="color:#090;">// ----- '''Event''' and Other Functions -----</span> | ||
Create any Language-Specific Functions (exception handling) | Create any Language-Specific Functions (exception handling) | ||
Create General Attach, Detach, and Error Handling Functions | Create General '''Attach''', '''Detach''', and '''Error''' Handling Functions: | ||
:On attach: | :On attach: Print Hello Message | ||
:On detach | :On detach: Print Goodbye Message | ||
:Print | |||
</font> | </font> | ||
Line 30: | Line 22: | ||
</font> | </font> | ||
|- valign="top" | |- valign="top" | ||
|<font face="courier new" family="monospace"> | |style=white-space:nowrap|<font face="courier new" family="monospace"> | ||
<span style="color:#090;">// ----- Main Code -----</span> | <span style="color:#090;">// ----- '''Main''' Code -----</span><br><br> | ||
Create | '''Create''' Manager Software Object<br> | ||
Hook Event Functions created above to Device | Hook '''Event''' Functions created above to Device<br> | ||
Open Device | '''Open''' Device<br> | ||
;Wait for 'Enter' key character input | |||
:Handle on-going attach and detach events | :Handle on-going attach and detach events | ||
:Exit upon | :Print Hello and Goodbye messages | ||
:Exit upon input | |||
'''Close''' Device | |||
Delete Device | Delete Device | ||
Line 52: | Line 45: | ||
</font> | </font> | ||
|} | |} | ||
</div> | </div> |
Latest revision as of 20:47, 25 April 2012
The Hello World example has 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 {{{3}}} for specific syntax:
// ----- Event and Other Functions ----- Create any Language-Specific Functions (exception handling) Create General Attach, Detach, and Error Handling Functions:
|
{{{1}}} | |
// ----- Main Code -----
Close Device Delete Device
|
{{{2}}} |