I'm fairly new to Arduino. I have connected the ITG-3200 gyroscope via I2C, and I'm now trying to read the sensor data. I am receiving some data, and it changes when I tilt the breadboard, but all the output is just gibberish characters, like
ü þ þ
This is my (partly stolen ^^' ) code:
#define GYROSCOPE 0x69
#include <Wire.h>
int x, y, z;
byte buff[6];
void setup() {
Serial.begin(9600);
Wire.begin();
}
void loop() {
// Delay the flow
delay(500);
Wire.beginTransmission(GYROSCOPE);
Wire.send(0x1D);
Wire.endTransmission();
Wire.requestFrom(GYROSCOPE,6);
int i = 0;
while(Wire.available()) {
buff[i] = Wire.receive();
i++;
}
// Convert to ints
x = (((int)buff[1]) << 8) | buff[0];
y = (((int)buff[3]) << 8) | buff[2];
z = (((int)buff[5]) << 8) | buff[4];
Serial.write(x);
Serial.write(" ");
Serial.write(y);
Serial.write(" ");
Serial.write(z);
Serial.write("\n");
}
I'm guessing the problem must be fairly simple to solve... Any ideas?