I recently purchased a 3-axis accelerometer from Amazon, and can't seem to find how it works. I've been looking for quite a while now, and haven't found any real clues. The x, y, and z values always seem to return the same values. They change when I tilt or move the accelerometer, but revert to about 120 for each reading. I am currently using this device with the Arduino Uno, using the following code:
int x=1,y=2,z=3;
void setup() {
pinMode(x, INPUT);
pinMode(y, INPUT);
pinMode(z, INPUT);
Serial.begin(9600);
}
void loop() {
Serial.println();
Serial.print(analogRead(x));
Serial.print(", ");
Serial.print(analogRead(y));
Serial.print(", ");
Serial.print(analogRead(z));
}
Also, how would I go about converting this to tilt?