Maker Pro
Maker Pro

Gyroscope & Compass Readings not changing

parag

Aug 17, 2015
4
Joined
Aug 17, 2015
Messages
4
Hello

Im interfacing IMU gy80 module with TivaC board.
Accelerometer is working fine.
Gyroscope & Compass Readings not changing continuously but when the device is power OFF and again ON that time readings before power OFF and after power ON are different.
BUT untill the device is powered off the readings will remain constant.

Hers my part of code..

---------------------------------------------------------------------------------
I'm initializing the L3G4200D gyrometer registers with following mentioned values
writeI2C0(Gyro_ADDR,CTRL_REG1,0xCF);
writeI2C0(Gyro_ADDR,CTRL_REG2,0x00);
writeI2C0(Gyro_ADDR,CTRL_REG3,0x08);
writeI2C0(Gyro_ADDR,CTRL_REG4,0x30);
writeI2C0(Gyro_ADDR,CTRL_REG5,0x00);
-------------------------------------------------------------------------------------


signed int getRotation_Y(){
signed int short raw = (signed int short) getRotation_rawY();
signed int Rotation = (signed int)raw;
return Rotation;
}

uint16_t getRotation_rawY(){
uint8_t rotData1, rotData2;
rotData1=readI2C0(Gyro_ADDR,OUT_Y_L);
rotData2=readI2C0(Gyro_ADDR,OUT_Y_H);
uint16_t rawY = (rotData2<<8)|rotData1;
return (rawY);
}

--------------------------------------------------------------------------------------

UART_OutUDec((unsigned int) rotationX)
{
if(n >= 10){
UART_OutUDec(n/10);
n = n%10;
}
UART_OutChar(n+'0'); /* n is between 0 and 9 */
}
}

 

donkey

Feb 26, 2011
1,301
Joined
Feb 26, 2011
Messages
1,301
I am no programming genius but it sounds to me like you have asked for these inputs once, nothing to refresh so it won't refresh them live.
 
Top