FRC125 / NU14

Codebase for 2014 Robot
5 stars 0 forks source link

I2C Communications to IMU board #12

Open schreiaj opened 10 years ago

schreiaj commented 10 years ago

We need to get the IMU talking to the CRIO. Rough code sample coming shortly (20 minutes)

schreiaj commented 10 years ago

Rough code that MIGHT read. No idea if it'll work.

I2C imu = I2C(1,125);
// Check that we can talk to the device otherwise handle this error
if imu.addressOnly(){
  // Handle the case that something gone and screwed up
  // BlameElectrical();
}

int[] buffer = int[6];

imu.read(0, 6, buffer);

yaw = buffer[0]<<8+buffer[1]; 
schreiaj commented 10 years ago

http://www.chiefdelphi.com/forums/showthread.php?p=1336742 Has some information on why we might have been getting 0s.