Quote:
Originally Posted by johnsmith11111
I'm programming in easy-C with a gyro. I had a simple autonomous function initialize the gyro, wait 1200 milliseconds, start the gyro, then go to a loop where it got the gyro value and printed it to screen. No matter how I turned the gyro, it only gave a readout of zero. I then downloaded the same code but without the 1.2 second wait, and it worked fine. When I try to embed this code into the rest of my autonomous code, it does not work. Can anyone help me?
|
That's a little confusing. The Initialize routine actually waits until the robot has been turned on for a second (settling time for vibration), then it does a one second calibration where it computes the average non-moving value. So you shouldn't need to 1.2 second wait.
I'm not sure why adding it changes anything, but you can look at a pretty simple sample program here that does work:
http://users.wpi.edu/~bamiller/WPILib/Samples.html
Please let us know if you find a bug in something that is causing your problem.