Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of FRDM_MMA8451Q by
Revision 8:dea072e6e164, committed 2016-02-05
- Comitter:
- ganeshgore
- Date:
- Fri Feb 05 05:47:57 2016 +0000
- Parent:
- 7:70775be9f474
- Child:
- 9:f92c43743573
- Commit message:
- Latest
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Feb 19 23:46:45 2013 +0000
+++ b/main.cpp Fri Feb 05 05:47:57 2016 +0000
@@ -2,17 +2,17 @@
#include "MMA8451Q.h"
#define MMA8451_I2C_ADDRESS (0x1d<<1)
+Serial pc(USBTX, USBRX); // tx, rx
int main(void) {
MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);
- PwmOut rled(LED_RED);
- PwmOut gled(LED_GREEN);
- PwmOut bled(LED_BLUE);
-
+ int rled,gled,bled;
while (true) {
- rled = 1.0 - abs(acc.getAccX());
- gled = 1.0 - abs(acc.getAccY());
- bled = 1.0 - abs(acc.getAccZ());
- wait(0.1);
+ rled = 100*(1+acc.getAccX());
+ gled = 100*(1+acc.getAccY());
+ bled = 100*(1+acc.getAccZ());
+
+ pc.printf("$%d %d %d;", rled,gled,bled);
+ wait(0.2);
}
-}
+}
\ No newline at end of file
