Set servo type in matlab?

Legacy support with Phidget21
temp89
Phidgetsian
Posts: 9
Joined: Sun Jul 17, 2011 7:33 am
Contact:

Set servo type in matlab?

Postby temp89 » Sun Jul 17, 2011 7:39 am

What is the matlab code for setting the servo type wit an advanced servo, specifically raw_us_mode?

AdamS

Re: Set servo type in matlab?

Postby AdamS » Tue Jul 19, 2011 11:22 am

calllib('phidget21', 'CPhidgetServo_getServoType', handle, 0, 2)

The '2' argument is the servo type. There is a structure in the C library for the servo types, but I am not 100% sure how Matlab would work with the structure. However, the structure is basically a type name to integer mapping starting from 1, so if you just look at it in the API document you can see that the raw_us_mode has a value of 2.

temp89
Phidgetsian
Posts: 9
Joined: Sun Jul 17, 2011 7:33 am
Contact:

Re: Set servo type in matlab?

Postby temp89 » Thu Jul 21, 2011 4:42 am

Thanks very much. A follow-up question, how do we define 'CPhidget_ServoTypePtr'? The library says it's made from itself and not an integer or float. When we try

calllib('phidget21', 'CPhidgetAdvancedServo_getServoType', handle, 0, valPtr)
SerTpe = get(valPtr, 'Value')

we get an error.

AdamS

Re: Set servo type in matlab?

Postby AdamS » Thu Jul 21, 2011 3:54 pm

The pointer should be declared as an int32 or however it is called in Matlab.


Return to “Matlab”

Who is online

Users browsing this forum: No registered users and 4 guests