have problem with 1057 4-Input Encoder on setEnable

C, C++, and Visual C++
pcsteven
Fresh meat
Posts: 2
Joined: Mon Aug 13, 2012 10:48 pm
Location: Taiwan (Kaohsiung)
Contact:

have problem with 1057 4-Input Encoder on setEnable

Postby pcsteven » Mon Aug 13, 2012 11:08 pm

i bought 1057 4-input encoder one mouth ago.

And i find i need to check the enable check-box on phidget control panel

to make it work on every time i restart the pc .

And i also find the function on user c/c++ Doc

CPhidgetEncoder_setEnabled

i try to use it but it not work.

following is my code: (is that any problem?)

//////////////////////////////

CPhidgetEncoderHandle G_K3_encoder;

CPhidgetEncoder_create ( &G_K3_encoder );

CPhidget_open ( (CPhidgetHandle) G_K3_encoder , SNnumber );

CPhidgetEncoder_setEnabled( G_K3_encoder , 0 , PTRUE ); <-- shouldn't it be enable?
CPhidgetEncoder_setEnabled( G_K3_encoder , 1 , PTRUE ); <-- shouldn't it be enable?

/////////////////////////////////////

thanks

User avatar
burley
Human-Cyborg Relations
Posts: 441
Joined: Tue Sep 27, 2011 2:37 pm
Location: Calgary
Contact:

Re: have problem with 1057 4-Input Encoder on setEnable

Postby burley » Tue Aug 14, 2012 7:33 am

You need to use the waitforattachment function after you try to open the device before enabling any of the encoders. What is happening is that the device hasn't finished opening by the time you are calling functions that use it.
Brian Burley
403-282-7335 ext. 6003
support@phidgets.com

pcsteven
Fresh meat
Posts: 2
Joined: Mon Aug 13, 2012 10:48 pm
Location: Taiwan (Kaohsiung)
Contact:

Re: have problem with 1057 4-Input Encoder on setEnable

Postby pcsteven » Tue Aug 14, 2012 10:01 am

thank you for your detail answer

it really works

thanks a lot ^ ^


Return to “C/C++”

Who is online

Users browsing this forum: No registered users and 1 guest