MPI 04.00 Reference >> mpiMotor

mpiMotorFeedback

Declaration

int32_t mpiMotorFeedback(MPIMotor                 motor,
                      MPIMotorFeedbackValues   *feedback)

Required Header: stdmpi.h

Description

mpiMotorFeedback gets the feedback position of a Motor (motor) and writes it into the location pointed to by feedback.

motor
A handle to a motor object
*feedback
A pointer to an array of feedback values
Return Values
MPIMessageOK
MPIMotorMessageMOTOR_INVALID

Sample Code

/* Display both primary and secondary feedback value */
void displayMotorFeedback(MPIMotor motor)
{
   MPIMotorFeedbackValues  feedback;
   int32_t                 returnValue;

/* Get motor's feedback position and write it to feedback */ returnValue = mpiMotorFeedback(motor, &feedback); msgCHECK(returnValue);
/* Print out primary and secondary feedback */ printf("Primary feedback value %lf\n", feedback[MPIMotorFeedbackInputPRIMARY]); printf("Secondary feedback value %lf\n", feedback[MPIMotorFeedbackInputSECONDARY]); }