Purdue PROS (IME) help!

After playing with PROS for a while I have stumbled upon a little issue with the IMEs.

According to Page Moved

This is how you set up the integrated motor encoders

init.c


void initialize() {
    // ...
    // Check count to ensure all IMEs are plugged in!
    int count = imeInitializeAll();
    // ...
}

main.h


// It may be wise to use #define to establish friendly IME names
// Closest IME to the Cortex (first on chain) gets #0, IME connected to that one gets #1,
// and so on
#define IME_LEFT_MOTOR 0
#define IME_RIGHT_MOTOR 1

opcontrol.c or auto.c


void ...() {
    // ...
    // Get IME tick count (conversion to rotations varies)
    int counts = imeGet(0);
    // Or if #define was used:
    int counts = imeGet(IME_LEFT_MOTOR);
    // Reset IME to zero
    imeReset(IME_RIGHT_MOTOR);
    // ...
}

So far when i try All of the above and try to compile i get a (too few arguments to function ‘imeGet’

My code looks like this:
NOTE: I dint feel it necessary to post the rest of main.h or init.c Here, but it is still in my code, also the wiring is correct and works fine with Easy C.

init.c


void initialize() 
{
 int count = imeInitializeAll();
}

main.h


#define IME_LEFT 0

auto.c


void autonomous() 
{
int EncoderLeft;
while (1) 
{
 EncoderLeft = imeGet(IME_LEFT);
}
}

I’ve also tried using

auto.c


void autonomous() 
{
int EncoderLeft;
while (1) 
{
 EncoderLeft = imeGet(0);
}
}

now after looking trough API.h i found

 
* @param address the IME address to fetch from 0 to IME_ADDR_MAX
 * @param value a pointer to the location where the value will be stored (obtained using the
 * "&" operator on the target variable name e.g. <code>imeGet(2, &counts)</code>)
 * @return true if the count was successfully read and the value stored in *value is valid;
 * false otherwise
 */
bool imeGet(unsigned char address, int *value);

so i also tried this and it actually compiled but only return a value of 1
auto.c


void autonomous() 
{
int EncoderLeft;
while (1) 
{
 EncoderLeft = imeGet(IME_LEFT, &EncoderLeft);
}
}

Has anyone gotten the IMEs to work if so can you please share the code.
Thanks in advanced.

You don’t need the return value as such, it indicates a succesful read not the current encoder value. Try this

void autonomous() 
{
    int EncoderLeft;

    while (1) 
        {
        if( imeGet(IME_LEFT, &EncoderLeft) )
            {
            // A good read so now do something with EncoderLeft
            }
        taskDelay(10);
        }
}

Don’t forget the task loop delays !

Good catch, the API documentation is up to date but our documenter appears to have missed the example code area during the run-up to the 2b04 fixes. We will fix the typo soon.

Works!

Thank you very much!!