
An m2x sample code that uses accelerometers. Not working yet.
Dependencies: MMA8451Q SocketModem jsonlite mbed
Fork of MTS_M2x_Example by
Revision 6:0dbcf434679b, committed 2014-01-05
- Comitter:
- mfiore
- Date:
- Sun Jan 05 07:03:49 2014 +0000
- Parent:
- 5:d4a4e2577be3
- Parent:
- 4:51ae5b9e1e9e
- Child:
- 7:b90e8119f3cd
- Commit message:
- update SocketModem library; remove wait before Cellular::init() function
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 Sun Jan 05 07:00:38 2014 +0000 +++ b/SocketModem.lib Sun Jan 05 07:03:49 2014 +0000 @@ -1,1 +1,1 @@ -https://mbed.org/teams/Multi-Hackers/code/SocketModem/#c7d8fe37981b +https://mbed.org/teams/Multi-Hackers/code/SocketModem/#3b40320f3f73 \ No newline at end of file
--- a/main.cpp Sun Jan 05 07:00:38 2014 +0000 +++ b/main.cpp Sun Jan 05 07:03:49 2014 +0000 @@ -4,19 +4,21 @@ using namespace mts; -const char key[] = ""; -const char feed[] = ""; -const char stream[] = "amb-temp"; +const char key[] = ""; // enter your m2x user account master key +const char feed[] = ""; // enter your blueprint feed id +const char stream[] = "amb-temp"; // Create a stream name // set to 1 for cellular shield board // set to 0 for wifi shield board -#define CELL_SHIELD 0 +#define CELL_SHIELD 1 +// ssid and phrase for wifi std::string ssid = "belkin54g"; std::string phrase = "hackathon"; Wifi::SecurityType security_type = Wifi::WPA; -int main() { +int main() +{ #if CELL_SHIELD MTSSerialFlowControl* serial = new MTSSerialFlowControl(PTD3, PTD2, PTA12, PTC8); serial->baud(115200); @@ -27,7 +29,7 @@ int max_tries = 5; int i; std::string apn = "wap.cingular"; - + i = 0; while (i++ < max_tries) { if (cell->getRegistration() == Cellular::REGISTERED) { @@ -39,7 +41,7 @@ wait(3); } } - + printf("signal strength: %d\n\r", cell->getSignalStrength()); i = 0; @@ -54,7 +56,7 @@ wait(1); } } - + i = 0; printf("bringing up PPP link\n\r"); while (i++ < max_tries) { @@ -84,7 +86,7 @@ printf("Connect: %s\n\r", wifi->connect() ? "Success" : "Failure"); printf("Is Connected: %s\n\r", wifi->isConnected() ? "True" : "False"); #endif - + /* send some data */ Client client; M2XStreamClient m2xClient(&client, key);