MMA7660 accelerometer and Mbed LPC1768 examp

The MMA7660FC is a digital output I²C, very low-power, low-profile capacitive micro-machined accelerometer featuring a low pass filter, compensation for zero-g offset and gain errors and conversion to six-bit digital values at a user configurable output data rate. The device can be used for sensor data changes, product orientation and gesture detection through an interrupt pin (INT). The device is housed in an extremely small 3 mm x 3 mm x 0.9 mm DFN package.

Features

Digital output I²C
3 mm x 3 mm x 0.9 mm DFN package
Low-power current consumption
Off mode: 0.4 µA
Standby mode: 2 µA
Active mode: Configurable down to 47 µA
Low-voltage operation: 2.4 – 3.6-volts
3-axis ±1.5 g MEMS sensor and CMOS interface controller built into one package
Configurable output data rate from one to 120 samples a second
Auto wake/sleep feature for low-power consumption
Tilt orientation detection for portrait/landscape capability
Gesture detection including shake and pulse detection

Layout

MMA7660 module MBed LPC1768
Vcc Vout
Gnd Gnd
SCL Pin 10
SDA Pin 9

Code

More details at https://os.mbed.com/components/MMA7660/

#include "mbed.h"
#include "MMA7660.h"
 
MMA7660 MMA(p28, p27);
 
DigitalOut connectionLed(LED1);
PwmOut Zaxis_p(LED2);
PwmOut Zaxis_n(LED3);
 
int main() {  
    if (MMA.testConnection())
        connectionLed = 1;
 
    while(1) {
        Zaxis_p = MMA.z();
        Zaxis_n = -MMA.z();
    }
 
}

Testing

Move the sensor and the LED 2 and LED 3 should light on and off

Links

1PCS NEW MMA7660 Replace MMA7260 3 Axis Triaxial accelerometer sensor module