View Single Post
  #1   Spotlight this post!  
Unread 01-02-2008, 22:57
Jennymcf Jennymcf is offline
Registered User
FRC #2453
 
Join Date: Jan 2008
Location: Honolulu
Posts: 3
Jennymcf is an unknown quantity at this point
Accelerometer and Gyroscope freezing in EasyC

Hi,

We're having a weird problem with our accelerometer and gyroscope using EasyC.

When using both the accelerometer and the gyroscope, we observe no output.
When using only the accelerometer, it works fine. (Sort of. The terminal output is a little messed up.. missing new line characters)
When using only the gyroscope, it works fine.
When using the accelerometer and initializing the gyro without reading any data, we observe no output.

Our code looks something like this (the syntax may not be totally precise because our robot laptop can't connect to our school's network):

int xaxis;
int yaxis;
int gyro;

InitAccelerometer(3); //analog input channel 3, 4 are the accelerometer
StartAccelerometer(3);
InitAccelerometer(4);
StartAccelerometer(4);
InitGyro(2); //analog input 2 is the gyro twist
StartGyro(2);

while(1){
xaxis=getAccelerometer(3);
yaxis=getAccelerometer(4);
gyro=getGyro(2);
PrintToScreen("xaxis= %d\n", (int)xaxis);
PrintToScreen("yaxis= %d\n", (int)yaxis);
PrintToScreen("gyro= %d\n", (int)gyro);
Wait(200);
}