Start project of The Things Network workshop with the MultiTech mDot

Dependencies:   libmDot mbed-rtos mbed

Fork of mDot_LoRa_Connect_Example_APP_EUI_KEY by MultiTech

Files at this revision

API Documentation at this revision

Comitter:
johanstokking
Date:
Mon Apr 04 21:26:16 2016 +0000
Parent:
7:8f2fd29c633a
Child:
9:d589fb5e68a4
Commit message:
Connect with The Things Network

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Apr 04 18:43:17 2016 +0000
+++ b/main.cpp	Mon Apr 04 21:26:16 2016 +0000
@@ -7,10 +7,10 @@
 
 // these options must match the settings on your Conduit
 // uncomment the following lines and edit their values to match your configuration
-static uint8_t config_app_eui[] = { 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04 };
-static uint8_t config_app_key[] = { 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04 };
+static uint8_t config_app_eui[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 };
+static uint8_t config_app_key[] = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x45 };
 
-static uint8_t config_frequency_sub_band = 1;
+static uint8_t config_frequency_sub_band = 7;
 
 int main() {
     int32_t ret;
@@ -45,10 +45,14 @@
     
     std::vector<uint8_t> temp;
     
-    for (int i = 0; i < 16; i++) {
+    for (int i = 0; i < 8; i++) {
         temp.push_back(config_app_eui[i]);    
     }
     
+    if ((ret = dot->setPublicNetwork(true)) != mDot::MDOT_OK) {
+        logError("failed to set public network");
+    }
+        
     logInfo("setting app eui");
     if ((ret = dot->setNetworkId(temp)) != mDot::MDOT_OK) {
         logError("failed to set app eui %d:%s", ret, mDot::getReturnCodeString(ret).c_str());