An m2x sample code that uses accelerometers. Not working yet.
Dependencies: MMA8451Q SocketModem jsonlite mbed
Fork of MTS_M2x_Example by
Diff: main.cpp
- Revision:
- 2:76e0d5968991
- Parent:
- 1:b12a128aae0e
- Child:
- 3:d24e8bec5610
- Child:
- 5:d4a4e2577be3
--- a/main.cpp Sat Jan 04 06:27:12 2014 +0000 +++ b/main.cpp Sat Jan 04 06:37:50 2014 +0000 @@ -4,13 +4,15 @@ using namespace mts; -const char key[] = "1f706ed9764457981e61b427767f65a5"; -const char feed[] = "5996c26815bd3245c8ec35089d51b614"; -const char stream[] = "test_test_test"; +const char key[] = "b26a78445f81fcc56e42ffa42350fb09"; +const char feed[] = "9ed5d71fe2b0b2ea6ddd7d8d65206250"; +const char stream[] = "amb-temp"; // set to 1 for cellular shield board // set to 0 for wifi shield board -#define CELL_SHIELD 1 +#define CELL_SHIELD 0 + +std::string ssid = "belkin54g"; int main() { #if CELL_SHIELD @@ -23,7 +25,7 @@ serial->baud(115200); Transport::setTransport(Transport::CELLULAR); Cellular* cell = Cellular::getInstance(); - cell->init(serial); + cell->init(serial, PTA4, PTC9); //DCD and DTR pins for KL46Z int max_tries = 5; int i; @@ -78,7 +80,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("", Wifi::WPA2, "")).c_str()); + printf("Set Network: %s\n\r", getCodeNames(wifi->setNetwork(ssid, Wifi::NONE, "")).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");