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:35:21 2012 +0000
Parent:
3:f2d3e041d8f2
Child:
5:bf5becf7469c
Commit message:
Pushed object declaration into main

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	Fri Oct 12 11:31:29 2012 +0000
+++ b/MMA8451Q.lib	Fri Oct 12 11:35:21 2012 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/emilmont/code/MMA8451Q/#db7126dbd63f
+http://mbed.org/users/emilmont/code/MMA8451Q/#c4d879a39775
--- a/main.cpp	Fri Oct 12 11:31:29 2012 +0000
+++ b/main.cpp	Fri Oct 12 11:35:21 2012 +0000
@@ -3,13 +3,13 @@
 
 #define MMA8451_I2C_ADDRESS (0x1d<<1)
 
+int main(void) {
+
 MMA8451Q acc(P_E25, P_E24, MMA8451_I2C_ADDRESS);
 PwmOut rled(LED_RED);
 PwmOut gled(LED_GREEN);
 PwmOut bled(LED_BLUE);
 
-int main(void) {
-
     while (true) {       
         rled = 1.0 - abs(acc.getAccX());
         gled = 1.0 - abs(acc.getAccY());