Here it is ...

Dependencies:   libxDot-mbed5 TSL2561

Fork of Dot-Examples by MultiTech

Revision:
36:5529d26e97e6
Parent:
35:b51d482e9731
Child:
37:4818522075f8
--- a/examples/src/ota_example.cpp	Tue Jul 24 11:57:49 2018 -0400
+++ b/examples/src/ota_example.cpp	Wed Jul 25 10:39:56 2018 -0400
@@ -148,12 +148,13 @@
       pc.printf("joining lora network.\r\n");
       join_network(&pc);
     } 
+
     
     // hourly loop
     while( counter < 12) {
 
       uint8_t light_data = get_light_data();
-      pc.printf("pseudo-light data: %d\r\n", light_data);
+      //pc.printf("pseudo-light data: %d\r\n", light_data);
       pc.printf("hour: %d\r\n", ++counter);
       
       
@@ -163,14 +164,17 @@
 
       // convert to ascii char && push to vector
       ascii_converter(buffer, light_data, &tx_data, &pc);
-      pc.printf("char buffer converted: %s\r\n", buffer);
+      pc.printf("char buffer: %s\r\n", buffer);
       
       if( counter < 12)
 	tx_data.push_back(' ');
       
-      send_data(tx_data, &pc);
-      pc.printf("size: %d\r\n", tx_data.size());
-      pc.printf("capacity: %d\r\n", tx_data.capacity());
+      // set the data_rate (from forum)
+      //dot->setTxDataRate(lora::DR_2);
+
+      //send_data(tx_data, &pc);
+      //pc.printf("size: %d\r\n", tx_data.size());
+      //pc.printf("capacity: %d\r\n", tx_data.capacity());
 
       // if going into deepsleep mode, save the session so we don't need to join again after waking up
       // not necessary if going into sleep mode since RAM is retained
@@ -195,11 +199,14 @@
 
     pc.printf("capacity tx_data: %d\r\n", tx_data.capacity());
     //tx_data.resize(tx_data.size());
-    //tx_data.resize(36);
+    //tx_data.resize();
     pc.printf("sized tx_data: %d\r\n", tx_data.size());
     //actually send the data
     pc.printf("sending data\r\n");
     
+
+    // set the data_rate (from forum)
+    dot->setTxDataRate(lora::DR_2);
     int retVal = send_data(tx_data, &pc);
     //while(retVal == 1)
     //retVal = send_data(tx_data, &pc);
@@ -207,7 +214,7 @@
     // erase vector data & reset counter
     tx_data.erase(tx_data.begin(), tx_data.end());
     counter = 0;
-    pc.printf("deleted tx_data and reset counter\r\n");
+    pc.printf("deleted tx_data and reset counter\r\ncap: %d size: %d\r\n", tx_data.capacity(), tx_data.size());
     
   }