[Acceleration] MMA7660 3-Axis Accelerometer Library

Download Include this in your Arduino/Libraries folder. Download: MMA7660.zip

Sample code

This code is also included in the zipfile in the above.
  1. #include Wire.h
  2. #include MMA7660.h
  3. void setup()
  4. {
  5.   Serial.begin(9600);
  6.   MMA7660.init();
  7. }
  8. void loop()
  9. {
  10.   int x,y,z;
  11.   delay(100);  There will be new values every 100ms
  12.   MMA7660.getValues(&x,&y,&z);
  13.   Serial.print(x );
  14.   Serial.print(x);
  15.   Serial.print( y );
  16.   Serial.print(y);
  17.   Serial.print( z );
  18.   Serial.println(z);
  19. }
]]>

You may also like...

10 Responses

  1. Manuel Montoya says:

    I get this error when I try to compile the test code
    In file included from MMA7660_test.cpp:2:
    C:Program Files (x86)arduino-1.0librariesMMA7660/MMA7660.h:29:22: error: WProgram.h: No such file or directory

    • Alessandro Proglio says:

      @Manuel Montoya:
      There are some changes needed since version 1 of Arduino:
      open the files MMA7660.cpp and MMA7660.h and replace the line
      #include "WProgram.h"
      with
      #include "Arduino.h"
      the Wire library now uses different methods, Ioy have to open MMA7660.cpp and replace
      Wire.send
      with
      Wire.write
      and
      Wire.read
      with
      Wire.receive

      • Tim says:

        Thanks a lot Alessandro :).

        • Jay says:

          I’m having the same problem, when I change what you suggested the error changes, now I get –
          Help?
          /Users/jasonscott/Documents/Arduino/libraries/MMA7660/MMA7660.cpp: In member function ‘void MMA::getValues(int*, int*, int*)’:
          /Users/jasonscott/Documents/Arduino/libraries/MMA7660/MMA7660.cpp:62: error: ‘class TwoWire’ has no member named ‘receive’
          /Users/jasonscott/Documents/Arduino/libraries/MMA7660/MMA7660.cpp:63: error: ‘class TwoWire’ has no member named ‘receive’
          /Users/jasonscott/Documents/Arduino/libraries/MMA7660/MMA7660.cpp:64: error: ‘class TwoWire’ has no member named ‘receive’

  2. Alessandro Proglio says:

    I’m sorry, I wrote the last two lines in the wrong order, you have to replace
    Wire.receive
    with
    Wire.read

    • chandu says:

      i get the values but not change the values when the sensor was moved
      why ? can you help in this ?

  3. Dee says:

    Hello, I think your blog might be having browser compatibility issues.
    When I look at your website in Safari, it looks fine but when opening in Internet
    Explorer, it has some overlapping. I just wanted
    to give you a quick heads up! Other then that, great blog!

  4. Hi MMA7660 Expert Tim,
    As a young lad I used to play the piano accordion. Now, as a young pensioner (71), I converted an old 120- (sgl. switch-) button Farfisa accordion bass section into MIDI to play with my Tyros3. Each chord has 4 to 5 notes and sound terrific, but it was a hell of a job, for I had to diode wire all chord combinations ! 🙁
    I also love to create that accordion “bellow shake” and for that purpose paralleled the 10K Pot from my Yamaha (MFC10) MIDI foot controller to vary it via a LDR-LED control.
    I just discovered that $200 “HOT Hand 3” audio volume (etc.) controller.
    I suppose its built around that “MMA7660FC” chip or similar.
    My electronics hobby knowledge as to work out how this chip could control the brightness of a LED.
    Because, if I knew that I could easily control the LDR,
    Is that very complex? If not, please kick me in the direction to help myself…
    Thank you in advance, ol’ Joh in St’go de Chile 🙂

  5. Harry van Soolen says:

    Tim I would appreciate it if you could update and make all of the fixes required to the .h and .cpp files. I tried using your test but won’t compile. And yes I’m a Dutchman as well (Rotterdammer).