Jordane Monney / Mbed OS mbed-os-example-lorawan
Revision:
59:197f40345978
Parent:
56:39847849d219
--- a/main.cpp	Tue Oct 08 14:01:59 2019 +0100
+++ b/main.cpp	Wed Nov 06 09:52:42 2019 +0000
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 #include <stdio.h>
-
+#include "mbed.h"
 #include "lorawan/LoRaWANInterface.h"
 #include "lorawan/system/lorawan_data_structures.h"
 #include "events/EventQueue.h"
@@ -26,7 +26,7 @@
 #include "lora_radio_helper.h"
 
 using namespace events;
-
+DigitalOut myled1(LED1);
 // Max payload size can be LORAMAC_PHY_MAXPAYLOAD.
 // This example only communicates with much shorter messages (<30 bytes).
 // If longer messages are used, these buffers must be changed accordingly.
@@ -36,7 +36,7 @@
 /*
  * Sets up an application dependent transmission timer in ms. Used only when Duty Cycling is off for testing
  */
-#define TX_TIMER                        10000
+#define TX_TIMER                        9000
 
 /**
  * Maximum number of events for the event queue.
@@ -103,7 +103,6 @@
         printf("\r\n LoRa initialization failed! \r\n");
         return -1;
     }
-
     printf("\r\n Mbed LoRaWANStack initialized \r\n");
 
     // prepare application callbacks
@@ -164,11 +163,11 @@
         return;
     }
 
-    packet_len = sprintf((char *) tx_buffer, "Dummy Sensor Value is %d",
+    packet_len = sprintf((char *) tx_buffer, "Sensor Value is %d",
                          sensor_value);
 
     retcode = lorawan.send(MBED_CONF_LORA_APP_PORT, tx_buffer, packet_len,
-                           MSG_UNCONFIRMED_FLAG);
+                           MSG_CONFIRMED_FLAG);
 
     if (retcode < 0) {
         retcode == LORAWAN_STATUS_WOULD_BLOCK ? printf("send - WOULD BLOCK\r\n")
@@ -218,6 +217,7 @@
     switch (event) {
         case CONNECTED:
             printf("\r\n Connection - Successful \r\n");
+             myled1 = 1;
             if (MBED_CONF_LORA_DUTY_CYCLE_ON) {
                 send_message();
             } else {