Problem reading from MMA7260 accelerometer

hi all,

im making a simple read from X/Y or Z axis of my MMA7260 accelerometer and the values are varying like they're oscillating...

heres my reading using a simple analog read:

0
0
0
0
78
383
731
533
0
0
0
0
79
400
731
481
0
0
0
37
343
730
495
0
0
3
143
732
638
50
0
6
177
735
608
0
0
0

it seems there some kind of periodic noise.. ive tried to sample using different frequencies (differente delay times) but the error is exactly the same.....

any hints?

hered my simple code:

/*
AnalogReadSerial
Reads an analog input on pin 0, prints the result to the serial monitor

This example code is in the public domain.
*/

void setup() {
Serial.begin(9600);
}

void loop() {
int sensorValue = analogRead(A0);
Serial.println(sensorValue, DEC);
delay(500);
}

thanks

got schematic?

but the error is exactly the same....

same real time period or same # of samples?

oh... I found the problem! Thanks!!

The problema was the SLEEP PIN (SL).. The accel is NOT sleeping if the pin is HIGH ... now it worked fine
:wink: