a Hello world to connect to The Things Network

Dependencies:   libmDot mbed-rtos mbed

Fork of mDot_LoRa_Connect_Example by MultiTech

Revision:
7:609e7bb06486
Parent:
6:8f7276e7d206
--- a/main.cpp	Thu Nov 19 20:10:43 2015 +0000
+++ b/main.cpp	Thu Nov 19 20:15:09 2015 +0000
@@ -5,10 +5,11 @@
 #include <vector>
 #include <algorithm>
 // these options must match the settings on your Conduit
-// uncomment the following lines and edit their values to match your configuration
+// TTN Keys
 static const uint8_t netowork_session_key_array[] = {0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C};
 static const uint8_t data_session_key_array[] = {0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C};
-static const uint8_t network_address_array[] = {0x02, 0x01, 0xBA, 0x01};
+// uncomment the following lines and edit their values to match your configuration
+//static const uint8_t network_address_array[] = {0x02, 0x01, 0xBA, 0x01}; // use yours based on http://thethingsnetwork.org/wiki/AddressSpace
 static std::vector<uint8_t> netowork_session_key (netowork_session_key_array, netowork_session_key_array + sizeof(netowork_session_key_array) / sizeof(uint8_t));
 static std::vector<uint8_t> data_session_key (data_session_key_array, data_session_key_array + sizeof(data_session_key_array) / sizeof(uint8_t));
 static std::vector<uint8_t> network_address (network_address_array, network_address_array + sizeof(network_address_array) / sizeof(uint8_t));
@@ -25,9 +26,11 @@
 
     dot->resetConfig();
 
+    dot->setLogLevel(mts::MTSLog::INFO_LEVEL);
+
+    // too lazzy to check all errors
     dot->setJoinMode(mDot::MANUAL);
     dot->setPublicNetwork(true);
-    dot->setLogLevel(mts::MTSLog::INFO_LEVEL);
     dot->setFrequencySubBand(config_frequency_sub_band);
     dot->setNetworkSessionKey(netowork_session_key);
     dot->setDataSessionKey(data_session_key);