Thread: Gyro Results
View Single Post
  #1   Spotlight this post!  
Unread 28-02-2008, 23:26
g_less1902 g_less1902 is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Nov 2007
Rookie Year: 2007
Location: Orlando
Posts: 7
g_less1902 is an unknown quantity at this point
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?

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\n" , gyroval ) ;
}
cnt = cnt + 1;
// Arcade2 ( 1 , 2 , 1 , 1 , 3 , 1 , 0 , 0 ) ;
Wait ( 100 ) ;
}
}