Opening a Channel: Difference between revisions
No edit summary |
No edit summary |
||
Line 23: | Line 23: | ||
|-| | |-| | ||
JavaScript=<syntaxhighlight lang=javascript> | JavaScript=<syntaxhighlight lang=javascript> | ||
ch.open(5000) | await ch.open(5000) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</tabber> | </tabber> | ||
''In Java | ''In Java, C#, and JavaScript <code>open()</code> is overloaded. In other languages, you would use <code>openWaitForAttachment(5000)</code> to perform the same function.'' | ||
The <code>openWaitForAttachment()</code> function will hold the program until a Phidget channel matching the one you specified is attached, or the function times out. There is a similar function called <code>open()</code> that will do the attachment process in the background, and allow your program to continue before the channel has been attached. | The <code>openWaitForAttachment()</code> function will hold the program until a Phidget channel matching the one you specified is attached, or the function times out. There is a similar function called <code>open()</code> that will do the attachment process in the background, and allow your program to continue before the channel has been attached. |
Latest revision as of 20:18, 19 April 2022
6 . Opening a Channel
After you have created and addressed a channel, you need to open it to begin the process of attaching the software channel to a physical channel.
For example:
ch.openWaitForAttachment(5000);
ch.open(5000);
ch.Open(5000);
Phdiget_openWaitForAttachment((PhidgetHandle)ch, 5000);
await ch.open(5000)
In Java, C#, and JavaScript open()
is overloaded. In other languages, you would use openWaitForAttachment(5000)
to perform the same function.
The openWaitForAttachment()
function will hold the program until a Phidget channel matching the one you specified is attached, or the function times out. There is a similar function called open()
that will do the attachment process in the background, and allow your program to continue before the channel has been attached.
The open()
and openWaitForAttachment()
functions only begin the process of matching the channel handle you created to a channel of a Phidget device, and do not actually open the Phidget itself. An open channel that does not match any Phidget channels at first can still attach to a matching channel that is plugged in long after it was first opened.