I'm trying to get this accelerometer working. I'm going to be using it with the GPS logger in a high-altitude balloon. I have one problem and a question. When I run this code, I get values of 14, 15, and 16 for X Y and Z, respectively. Does it make sense to get those values? Also, the problem is that, when I run this code, the values don't change. Can you see why this is happening? Thanks.
- Code: Select all
const int xInput = A0;
const int yInput = A1;
const int zInput = A2;
void setup()
{
analogReference(EXTERNAL);
Serial.begin(9600);
}
void loop()
{
int xRaw = xInput;
int yRaw = yInput;
int zRaw = zInput;
Serial.print("X: ");
Serial.print(xRaw);
Serial.print(", Y: ");
Serial.print(yRaw);
Serial.print(", Z: ");
Serial.print(zRaw);
String AccValues = ",Accel=";
AccValues = AccValues + xRaw + yRaw + zRaw;
Serial.print(AccValues);
}