Download Print this page

Parallax 27911 Manual page 12

Gyroscope module kickstart

Advertisement

x = ((MSB << 8) | LSB);
MSB = readI2C(0x2B);
LSB = readI2C(0x2A);
y = ((MSB << 8) | LSB);
MSB = readI2C(0x2D);
LSB = readI2C(0x2C);
z = ((MSB << 8) | LSB);
}
int readI2C (byte regAddr) {
Wire.beginTransmission(Addr);
Wire.write(regAddr);
Wire.endTransmission();
Wire.requestFrom(Addr, 1);
while(!Wire.available()) { };
return(Wire.read());
}
void writeI2C (byte regAddr, byte val) {
Wire.beginTransmission(Addr);
Wire.write(regAddr);
Wire.write(val);
Wire.endTransmission();
}
Note: To view the results of the demonstration, after uploading is complete click the Serial
Monitor icon in the Arduino IDE. This displays the Serial Monitor window. Momentarily
depress the Reset button on the Arduino board to restart the sketch.
For More Information
See the
3-Axis Gyroscope (#27911)
More information on gyroscopes and inertial navigation may be found by searching Wikipedia:
Gyroscope.
Combine the 3-axis gyroscope with the
and
Compass Module 3-Axis HMC5883L
Copyright © Parallax Inc.
// Register address to read
// Terminate request
// Read a byte
// Wait for receipt
// Get result
data sheet.
Parallax MMA7455 3-Axis Accelerometer Module
to create a 9-axis inertial momentum unit (IMU)
Page 12 of 12

Advertisement

loading
Need help?

Need help?

Do you have a question about the 27911 and is the answer not in the manual?