Module 2 ECEN 5803 Project 1 Submitted by 1. Rahul Yamasani 2. Srivishnuj Alvakonda

Dependencies:   MMA8451Q TSI mbed

Fork of FRDM_MMA8451Q by mbed official

Revision:
0:d9c1551e1fdc
Child:
2:41db78380a6e
diff -r 000000000000 -r d9c1551e1fdc main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Oct 11 10:56:33 2012 +0000
@@ -0,0 +1,20 @@
+#include "mbed.h"
+#include "MMA8451Q.h"
+
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
+
+int main(void) {
+    DigitalOut led(LED_GREEN);
+    MMA8451Q acc(P_E25, P_E24, MMA8451_I2C_ADDRESS);
+    printf("WHO AM I: 0x%2X\r\n", acc.getWhoAmI());
+    
+    while (true) {
+        printf("-----------\r\n");
+        printf("acc_x: %d\r\n", acc.getAccX());
+        printf("acc_y: %d\r\n", acc.getAccY());
+        printf("acc_z: %d\r\n", acc.getAccZ());
+        
+        wait(1);
+        led = !led;
+    }
+}