Products for USB Sensing and Control
It is currently Wed May 22, 2013 8:46 am

All times are UTC - 7 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Thu Mar 31, 2011 1:08 pm 
Offline
Fresh meat

Joined: Thu Mar 31, 2011 1:04 pm
Posts: 3
Does anyone have code working with the circular touch sensor on Windows CE? I can't seem to find out where to even begin getting my Phidget device to work.


Top
 Profile Send private message  
 
PostPosted: Thu Mar 31, 2011 1:15 pm 
Offline
Lead Developer
User avatar

Joined: Mon Jun 20, 2005 8:46 am
Posts: 2351
Location: Canada
circular touch is an interfacekit, have a look at any interfacekit examples.

-Patrick


Top
 Profile Send private message  
 
PostPosted: Sun Apr 03, 2011 3:45 pm 
Offline
Fresh meat

Joined: Thu Mar 31, 2011 1:04 pm
Posts: 3
My program is crashing when trying to use the API call:

CPhidgetInterfaceKit_getSensorValue (CPhidgetInterfaceKitHandle, int Index, int *pVal);

I'm finding it very difficult to debug this issue. Would inputting the wrong index be the reason for crashing? How do I know what index I need to use for the CircularTouchSensor?

I have the InterfaceKit and Handle setup using other API calls, perhaps what I'm doing is wrong?

EDIT: When trying to open the device using it's serial number (55325), I am able to connect to it, but I still get the error when trying to read from it. However, if I change the serial number to be 99999 it times out when calling "waitForAttachment."


Top
 Profile Send private message  
 
PostPosted: Mon Apr 04, 2011 9:20 am 
Offline
Lead Developer
User avatar

Joined: Mon Jun 20, 2005 8:46 am
Posts: 2351
Location: Canada
you need to use index 0 for the sensor.

serial number 99999 times out because you don't have an interfacekit with that serial number plugged in...

-Patrick


Top
 Profile Send private message  
 
PostPosted: Mon Apr 04, 2011 11:14 am 
Offline
Fresh meat

Joined: Thu Mar 31, 2011 1:04 pm
Posts: 3
Ah I got it to work! Thanks for the help. I found out my error was coming from my own method of opening a handle. I have an older version of the "phidgets21.dll" and for some reason there is a linking error when I'm trying to use the API calls.

In order to work around this error, I had to manually load the library and use this code:

Code:
bool InterfaceKit::load_Pointers()
{
   HMODULE m_hModule = LoadLibrary(_T("phidget21.dll"));
   if (m_hModule != 0)
   {
// Get Touch Sensor API entry points
      m_iPhidgets.create = (PhidgetInterfaceKit_create)::GetProcAddress(m_hModule, _T("CPhidgetInterfaceKit_create"));
      m_iPhidgets.open = (Phidget_open)::GetProcAddress(m_hModule, _T("CPhidget_open"));
      m_iPhidgets.waitForAttachment = (Phidget_waitForAttachment)::GetProcAddress(m_hModule, _T("CPhidget_waitForAttachment"));
      m_iPhidgets.close = (Phidget_close)::GetProcAddress(m_hModule, _T("CPhidget_close"));
      m_iPhidgets.destroy = (Phidget_delete)::GetProcAddress(m_hModule, _T("CPhidget_delete"));
      m_iPhidgets.getSensorValue = (PhidgetInterfaceKit_getSensorValue)::GetProcAddress(m_hModule, _T("CPhidgetInterfaceKit_getSensorValue"));
      return true;
   }
   return false;
}

//create and open the Phidget
bool InterfaceKit::start () {
   if(!load_Pointers())
      return false;

   m_iPhidgets.create(&m_hInterfaceKit);
   m_iPhidgets.open((CPhidgetHandle)m_hInterfaceKit, 55325);
   if (m_iPhidgets.waitForAttachment((CPhidgetHandle)m_hInterfaceKit, 10000))
      return false;
   return true;
}


Have you ever encountered a linking error? In addition, do you think that a newer version of the dll would fix this problem?

Thanks


Top
 Profile Send private message  
 
PostPosted: Sat Mar 31, 2012 2:41 am 
Offline
Fresh meat

Joined: Sat Mar 31, 2012 2:39 am
Posts: 1
Good Work!!!


Thanks to sharing!!!


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 7 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group