Thread: 2008 Gyro Code
View Single Post
  #1   Spotlight this post!  
Unread 09-02-2008, 09:47
FireJet FireJet is offline
Registered User
AKA: Jero Sutlovic
FRC #2386 (Trojans)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Burlington, Ontario
Posts: 8
FireJet is an unknown quantity at this point
2008 Gyro Code

Hi. I'm using Kevin's new 2008 code, but I can't figure out how to get the Gyro working in either autonomous mode or user mode. I believe that I set up the code right:

Code:
void Teleop_Init(void)
{
	Initialize_Gyro();
	
	if (Get_Gyro_Bias_Status() == GYRO_BIAS_NOT_DONE)
	{
		Start_Gyro_Bias_Calc();
		
		
		while (t2 < 76)
		{
			printf("Calculating gyro bias. State: %d.\n\r", Get_Gyro_Bias_Status());
			//Start_Gyro_Bias_Calc();
			t2++;
		}
		

		Stop_Gyro_Bias_Calc();
		
		printf("Gyro bias calculated: %ld.\n\r", Get_Gyro_Bias());
		
	}

}
Code:
void Teleop(void)
{
    ...

    	Process_Gyro_Data();
	tmpangle = Get_Gyro_Angle();
	printf("Gyro Angle %d\n\r", tmpangle);

    ...
}

But unfortunately, the only output I get is "Gyro Angle 0". I'm sure I've got the gyro connected right, as I get values from Get_Analog_Value (and they change), but I don't get anything from Kevin's code. Can anyone help?