Gyro Results

Hi,

Below is an EasyC sample program to test our ADXR300 from Sparkfun.
When I manually rotate the gyro 90 degrees, the result I get is about 35 degrees.

We tested the 80Deg/s from this years kit, and the 150Deg/s from last years kit, and they work correctly in EasyC.

In ChiefDelphi there is a thread to multiply the answer by 2.5.
But it doesn’t look like it is correct.

I tried using Kevin Watsons IFI code in MPLab, and the gyro works correctly,
and I get expected results, however all of our code has been built with EasyC.

I downloaded the Jan 2008 WPILib libraries, and installed it in EasyC, but still don’t get the expected results.

Is there something I am done incorrectly? :frowning:

Thanks,
Eric Grajales

#include “Main.h”

void main ( void )
{
int gyroval = 0;
long cnt = 0;

  SetGyroType ( 1 , ADXRS300 ) ;
  InitGyro ( 1 ) ;
  Wait ( 2000 ) ;
  SetGyroDeadband ( 1 , 5 ) ;
  StartGyro ( 1 ) ;
  while ( TRUE )
  {
        gyroval = GetGyroAngle ( 1 );
        if ( (cnt % 5) == 0 )
        {
              PrintToScreen ( "GyroVal = %d

" , gyroval ) ;
}
cnt = cnt + 1;
// Arcade2 ( 1 , 2 , 1 , 1 , 3 , 1 , 0 , 0 ) ;
Wait ( 100 ) ;
}
}

We had a similar experience with our ACXRS300 and EasyC, but not as severe as yours. For our purposes it’s no big deal. I would try decreasing the deadband and see if that helps.

Also take the wait(100) from the bottom of your code. Also the wait (2000) after InitGyro is unecessary as the InitGyro has a built in pause to center the gyro.

Call SetGyroType ( 1 , ADXRS300 ) ;
after InitGyro ( 1 ) ;