Dear all,
I am using this very simple code to try and read data from my GY-61 accelerometer where I am trying to read the x-acceleration, y-acceleration, and z-acceleration in the Serial print.
int xpin = A0;
int ypin = A1;
int zpin = A2;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int x = analogRead(xpin);
delay(1);
int y = analogRead(ypin);
delay(1);
int z = analogRead(zpin);
Serial.print(x);
Serial.print("\t\t");
Serial.print(y);
Serial.print("\t\t");
Serial.print(z);
Serial.print("\n");
delay(50);
}
I have done no calibration yet. Since I am not understanding why I get the following values:
(Note that the first on every line after the -> is surpassingly the x-acceleration followed by y and z respectively)
16:28:08.364 -> 638 654 654
16:28:08.435 -> 638 654 654
16:28:08.470 -> 638 654 654
16:28:08.537 -> 638 654 654
16:28:08.572 -> 638 654 654
16:28:08.638 -> 638 654 654
16:28:08.708 -> 638 654 654
16:28:08.746 -> 638 654 654
16:28:08.784 -> 638 654 654
16:28:08.853 -> 638 654 654
16:28:08.890 -> 638 654 654
16:28:08.958 -> 638 654 654
16:28:08.995 -> 638 654 654
16:28:09.067 -> 638 654 654
16:28:09.101 -> 638 654 654
16:28:09.168 -> 638 654 654
16:28:09.241 -> 638 654 654
16:28:09.275 -> 638 654 654
16:28:09.346 -> 638 654 654
16:28:09.384 -> 638 654 654
16:28:09.454 -> 638 654 654
16:28:09.491 -> 638 654 654
16:28:09.524 -> 638 654 654
16:28:09.597 -> 638 654 654
16:28:09.635 -> 638 654 654
16:28:09.700 -> 638 654 654
16:28:09.767 -> 638 654 654
16:28:09.800 -> 638 654 654
16:28:09.873 -> 638 654 654
16:28:09.912 -> 639 654 654
16:28:09.978 -> 638 654 654
16:28:10.013 -> 639 654 654
16:28:10.084 -> 638 654 654
16:28:10.118 -> 638 654 654
16:28:10.188 -> 639 654 654
16:28:10.225 -> 639 654 654
16:28:10.295 -> 639 654 654
16:28:10.329 -> 638 654 654
16:28:10.396 -> 639 654 654
16:28:10.434 -> 639 654 654
16:28:10.504 -> 638 654 654
16:28:10.540 -> 639 654 654
16:28:10.618 -> 639 654 654
16:28:10.650 -> 638 654 654
16:28:10.725 -> 639 654 654
16:28:10.762 -> 638 654 654
This is even when I am moving the accelerometer (flipping it upside down, tapping the breadboard).
Anybody knows how to troubleshoot what might go wrong here?
Note: I soldered the accelerometer on the pins (that were delivered with it) myself, but the connections all seem to be fine. Also I used a 3.3V for my VCC with a 3.3V analog reference.
Any help would be great. Thanks!
Best, Giel