Example program to PWM drive the RGB LED depending on the accelerometer reading

Dependencies:   MMA8451Q mbed

Fork of FRDM_MMA8451Q by Emilio Monti

Files at this revision

API Documentation at this revision

Comitter:
chris
Date:
Fri Oct 12 11:02:58 2012 +0000
Parent:
1:91f83cc244b3
Child:
3:f2d3e041d8f2
Commit message:
Updated the hello world example in doxygen

Changed in this revision

MMA8451Q.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/MMA8451Q.lib	Thu Oct 11 14:27:02 2012 +0000
+++ b/MMA8451Q.lib	Fri Oct 12 11:02:58 2012 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/emilmont/code/MMA8451Q/#d2630136d51e
+http://mbed.org/users/emilmont/code/MMA8451Q/#7a43c23c04f9
--- a/main.cpp	Thu Oct 11 14:27:02 2012 +0000
+++ b/main.cpp	Fri Oct 12 11:02:58 2012 +0000
@@ -1,20 +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;
-    }
-}
+#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: %.3f\r\n", acc.getAccX());
+        printf("acc_y: %.3f\r\n", acc.getAccY());
+        printf("acc_z: %.3f\r\n", acc.getAccZ());
+        
+        wait(1);
+        led = !led;
+    }
+}