The main.cpp program below demonstrates a simple way to interface with the MMA8452 accelerometer. The function reads in the acceleration data in the X, Y, and Z directions and displays them through a serial com port on a PC. The Putty Output figure below shows the output of the accelerometer using Putty. The program also dims or brightens the mbed LEDs 1-3 based on whether or not they are at 'level'( 0 Gs) or above respectively. The video below previews the code in action.

Dependencies:   MMA8452 mbed

Fork of MMA8452_Test by Ashley Mills

Revision:
5:756f9b157319
Parent:
4:936b60956489
Child:
6:e3100f66ed6a
--- a/MMA8452.lib	Wed Mar 05 17:04:27 2014 +0000
+++ b/MMA8452.lib	Thu Mar 06 18:07:58 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/ashleymills/code/MMA8452/#27d839e6dc0e
+http://mbed.org/users/ashleymills/code/MMA8452/#4d6cd7140a71