
An m2x sample code that uses accelerometers. Not working yet.
Dependencies: MMA8451Q SocketModem jsonlite mbed
Fork of MTS_M2x_Example by
Revision 5:d4a4e2577be3, committed 2014-01-05
- Comitter:
- mfiore
- Date:
- Sun Jan 05 07:00:38 2014 +0000
- Parent:
- 2:76e0d5968991
- Child:
- 6:0dbcf434679b
- 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 Sat Jan 04 06:37:50 2014 +0000 +++ b/SocketModem.lib Sun Jan 05 07:00:38 2014 +0000 @@ -1,1 +1,1 @@ -https://mbed.org/teams/Multi-Hackers/code/SocketModem/#571e0ef6c8dc +https://mbed.org/teams/Multi-Hackers/code/SocketModem/#c7d8fe37981b
--- a/main.cpp Sat Jan 04 06:37:50 2014 +0000 +++ b/main.cpp Sun Jan 05 07:00:38 2014 +0000 @@ -4,8 +4,8 @@ using namespace mts; -const char key[] = "b26a78445f81fcc56e42ffa42350fb09"; -const char feed[] = "9ed5d71fe2b0b2ea6ddd7d8d65206250"; +const char key[] = ""; +const char feed[] = ""; const char stream[] = "amb-temp"; // set to 1 for cellular shield board @@ -13,14 +13,11 @@ #define CELL_SHIELD 0 std::string ssid = "belkin54g"; +std::string phrase = "hackathon"; +Wifi::SecurityType security_type = Wifi::WPA; int main() { #if CELL_SHIELD - for (int i = 30; i >= 0; i = i - 2) { - wait(2); - printf("Waiting %d seconds...\n\r", i); - } - MTSSerialFlowControl* serial = new MTSSerialFlowControl(PTD3, PTD2, PTA12, PTC8); serial->baud(115200); Transport::setTransport(Transport::CELLULAR); @@ -80,7 +77,7 @@ Transport::setTransport(Transport::WIFI); Wifi* wifi = Wifi::getInstance(); printf("Init: %s\n\r", wifi->init(serial) ? "SUCCESS" : "FAILURE"); - printf("Set Network: %s\n\r", getCodeNames(wifi->setNetwork(ssid, Wifi::NONE, "")).c_str()); + printf("Set Network: %s\n\r", getCodeNames(wifi->setNetwork(ssid, security_type, phrase)).c_str()); printf("Set DHCP: %s\n\r", getCodeNames(wifi->setDeviceIP("DHCP")).c_str()); printf("Signal Strnegth (dBm): %d\n\r", wifi->getSignalStrength()); printf("Is Connected: %s\n\r", wifi->isConnected() ? "True" : "False");