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
", (int)xaxis);
PrintToScreen("yaxis= %d
", (int)yaxis);
PrintToScreen("gyro= %d
", (int)gyro);
Wait(200);
}