Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Gyro not working (http://www.chiefdelphi.com/forums/showthread.php?t=63892)

1594code 12-02-2008 17:21

Gyro not working
 
Our gyro used to work, but now it doesn't. We have tried using old gyros from previous years, but they do not work either. Perhaps it has something to do with our code. We are using WPILib:
InitGyro(1);
StartGyro(1);
Wait(2000);

while(1){
printf("Angle %d\r", GetGyroAngle(1));
}

The output is "0" until the gyro is rotated a large amount (usually near 360 degrees). Then the output is random, ranging from low values into the thousands, with no correlation to the degree of rotation.

Any ideas what our problem might be? Any help would be greatly appreciated!

psy_wombats 12-02-2008 18:13

Re: Gyro not working
 
I'm not sure what type of number that will return, (int, long, etc), but I've had problems printing out longs and the like without %d. Check what the function returns.

Sorry, I'm not sure about this one.

fstumpo 12-02-2008 18:16

Re: Gyro not working
 
Try typecasting:

while(1){
printf("Angle %d\r", (int) GetGyroAngle(1));
}


All times are GMT -5. The time now is 01:00.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi