MMA7660FC I2C accelerometer with Arduino


Now i know how to get the sensor going. Now i don't understand how i can get the correct Z angle. He gives a value of G-power(angle) in time, but i can not get it in angle.

I want him to remember the 0° stand from the begin And when i turn 90 degrees, he gives me " + 90° ' " Or something like that.

Can someone help me?


Can you explain a bit more about the following code?

  unsigned char REG_ADDRESS[3];
  int i=0;
  Wire.send(0x00);  // register to read
  Wire.requestFrom(I2C_ADDRESS, 3); // read a byte

Thx in advance


switch (x)
          case 0:  Serial.print("  0.00 'C"); break;
          case 1:  Serial.print("  2.69 'C"); break;
          case 2:  Serial.print("  5.38 'C"); break;
          case 3:  Serial.print("  8.08 'C"); break;

I allways wonder if there is a formula to be used instead?

a LookUpTable - array - could be more (memory) efficient.

int Xar = { 0,269,528, 808, ....};   // vales as int *100 
int Yar = ...

and then just use

Serial.print(Xar[x]/100.0, 2), Serial.print(" 'C");  // div by 100.0 to get float again;

instead of the big switch, would prob. save additional memory

my 2 cents Rob