mikeflores2000 AT&T MultiTech M2X Exercises book
Dependencies: M2XStreamClient MMA8451Q SocketModem jsonlite mbed
Fork of M2X_MTS_Accel by
Diff: main.cpp
- Revision:
- 3:3aa188afd648
- Parent:
- 2:93ca5135c262
- Child:
- 4:8157d7b1cd01
--- a/main.cpp Thu Aug 21 22:45:33 2014 +0000 +++ b/main.cpp Fri Aug 22 07:42:15 2014 +0000 @@ -27,8 +27,8 @@ #define CELL_SHIELD 0 // ssid and phrase for wifi -std::string ssid = "DevLab"; // Replace with your Wifi ID (SSID) -std::string phrase = "MultiTech"; // Replace with your Wifi phrase (password) +std::string ssid = "HD-Members-5Ghz"; // Replace with your Wifi ID (SSID) +std::string phrase = "hackerdojo"; // Replace with your Wifi phrase (password) Wifi::SecurityType security_type = Wifi::WPA; // Replace with your Wifi security type int main() @@ -120,10 +120,12 @@ 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)); +// 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", +max(abs(roll), abs(pitch)) * 180.0 / 3.14159; +printf("pitch: %5.1f roll: %5.1f maxTilt: %5.1f\n\r", pitch, roll, maxTilt); // If the maximum title is over 20 degrees, then send // data to stream if (maxTilt > 20) { @@ -131,5 +133,5 @@ printf("send() returned %d\r\n", ret); wait(1); } } - + } \ No newline at end of file