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); 
void loop() {
 Serial.print(", ");
 Serial.print(", ");

Also, how would I go about converting this to tilt?

  • $\begingroup$ I copy your code inline to combat link rot. Also, I notice on the Amazon postings that there is Arduino code available for this device. Have you tried it? $\endgroup$ Dec 8, 2012 at 6:52
  • $\begingroup$ I didn't find any... Could you possibly link me to it? $\endgroup$
    – Dylan Katz
    Dec 8, 2012 at 6:56
  • $\begingroup$ A quick Google seems to bring up a number of examples: Google Code Project, Arduino Forum, DFRobot Example, GE Tech Wiki. $\endgroup$ Dec 8, 2012 at 7:04

1 Answer 1


There is a project on Google Code called MMA7361-library. The GE Tech Wiki has a simple example showing how to use this library. Copied inline below for posterity.

#include <AcceleroMMA7361.h>
AcceleroMMA7361 accelero;
int x;
int y;
int z;
void setup()
 accelero.begin(13, 12, 11, 10, A0, A1, A2);
 accelero.setARefVoltage(5); //sets the AREF voltage to 3.3V
 accelero.setSensitivity(LOW); //sets the sensitivity to +/-6G
void loop()
 x = accelero.getXAccel();
 y = accelero.getYAccel();
 z = accelero.getZAccel();
 Serial.print("\nx: ");
 Serial.print(" \ty: ");
 Serial.print(" \tz: ");
 delay(500); //make it readable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.