mikeflores2000 AT&T MultiTech M2X Exercises book
Dependencies: M2XStreamClient MMA8451Q SocketModem jsonlite mbed
Fork of M2X_MTS_Accel by
Revision 4:8157d7b1cd01, committed 2014-09-04
- Comitter:
- mikeflores2000
- Date:
- Thu Sep 04 21:10:40 2014 +0000
- Parent:
- 3:3aa188afd648
- Commit message:
- updated with new SocketModem library.
Changed in this revision
SocketModem.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/SocketModem.lib Fri Aug 22 07:42:15 2014 +0000 +++ b/SocketModem.lib Thu Sep 04 21:10:40 2014 +0000 @@ -1,1 +1,1 @@ -https://mbed.org/teams/Multi-Hackers/code/SocketModem/#e0a437f61854 +https://mbed.org/teams/Multi-Hackers/code/SocketModem/#9a2c7ed27744
--- a/main.cpp Fri Aug 22 07:42:15 2014 +0000 +++ b/main.cpp Thu Sep 04 21:10:40 2014 +0000 @@ -120,18 +120,21 @@ y = acc.getAccY(); z = acc.getAccZ(); printf("Accel X: %1.2f, Y: %1.2f, Z: %1.2f\n\r", x, y, z); + // Calculate pitch and roll. Find the maximum tilt angle. float pitch = atan(x / sqrt(y * y + z * z)); float roll = atan(y / sqrt(x * x + z * z)); float maxTilt = max(abs(roll), abs(pitch)) * 180.0 / 3.14159; -printf("pitch: %5.1f roll: %5.1f maxTilt: %5.1f\n\r", +printf("Pitch: %5.1f roll: %5.1f maxTilt: %5.1f\n\r", pitch, roll, maxTilt); +wait(10); +printf("\n"); // If the maximum title is over 20 degrees, then send // data to stream if (maxTilt > 20) { ret = m2xClient.post(feed, stream, maxTilt); -printf("send() returned %d\r\n", ret); -wait(1); +printf("maxTilt EXCEEDED 20 !!!! send() returned %d\r\n", ret); +wait(10); } } } \ No newline at end of file