I have problems with the sparkfun MMA7361 readings, I only detect significant changes when for example, rotate the accelerometer along it's x axis (the y value changes indicating up/down), and so on, but when I move the accelerometer up and down and not along one axis, I don't detect anything, what's the problem with my readings... Thanks... PD, I connected all of the pins except ST (selftest) and the 0g and gselec....
#include <AcceleroMMA7361.h>
AcceleroMMA7361 accelero;
int x_change;
int y_change;
int x;
int y;
int z;
void setup()
{
Serial.begin(9600);
accelero.begin(13, 12, 11, 10, A4, A2, A0);
accelero.setARefVoltage(5);
accelero.calibrate();
}
void loop()
{
x_change = x - accelero.getXAccel();
y_change = y - accelero.getYAccel();
x = accelero.getXAccel();
y = accelero.getYAccel();
if(x_change > 20)
{
Serial.print("LEFT\t");
}
else if (x_change < -20)
{
Serial.print("RIGHT\t");
}
else
{
Serial.print("NONE\t");
}
if(y_change > 15)
{
Serial.print("DOWN\n");
}
else if(y_change < -15)
{
Serial.print("UP\n");
}
else
{
Serial.print("NONE\n");
}
delay(500);
}