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:264bba6d39ee, committed 2015-05-07
- Comitter:
- lmsousa
- Date:
- Thu May 07 10:00:52 2015 +0000
- Parent:
- 7:70775be9f474
- Commit message:
- Sends the KL25Z acelerometer values to the serial port. Fixed some issues with serial messages.
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 Thu May 07 10:00:52 2015 +0000
@@ -2,17 +2,25 @@
#include "MMA8451Q.h"
#define MMA8451_I2C_ADDRESS (0x1d<<1)
-
-int main(void) {
+Serial pc(USBTX, USBRX);
+int main(void)
+{
+ pc.baud(9600);
MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);
PwmOut rled(LED_RED);
PwmOut gled(LED_GREEN);
PwmOut bled(LED_BLUE);
while (true) {
+ pc.printf("X= %g \n\r",acc.getAccX());
rled = 1.0 - abs(acc.getAccX());
+
+ pc.printf("Y= %g \n\r",acc.getAccY());
gled = 1.0 - abs(acc.getAccY());
+
+ pc.printf("Z= %g \n\n\r",acc.getAccZ());
bled = 1.0 - abs(acc.getAccZ());
- wait(0.1);
+ wait(1);
+
}
}
