View Single Post
  #2   Spotlight this post!  
Unread 04-02-2008, 22:33
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,567
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Gyro problems, crossposted from Electrical

Quote:
Originally Posted by EFastring View Post
in this thread I asked about testing the kit gyro and was given a programming answer, so I will continue my programming question here.

I am wanting the easiest way to test my gyro to see if it is dead.

I have the kit gyro hooked up with a PWM cable, with the white cable connected to TW(twist), the black cable connected to GB (ground), and the red cable to 5R (+5V). I plug it into the Robot Controllers Analog input 1 with the colors corresponding to those on the inputs.

In my code, under user_routines.c I have added the following

Code:
double yawtest = 0;
yawtest = Get_Analog_Value( rc_ana_in01 );
printf("yawtest %d\r", yawtest);
I get a number back that does not change (17535).

I am definitely hooked to TW (twist) and not RW (relative temperature).

At this point I am really just wanting to see a number that changes when I move the gyro chip. Am I doing something wrong or do I have a dead gyro? Is there an easier way to see if it is dead?
Get_Analog_Value returns an int, so you should declare yawtest as an int. Also, the %d in the printf expects an int.

double is a floating point type, which should be avoided whenever possible on the robot controller since it does not have a floating point unit, so all floating point must be done by software and is very big and slow.