B-L072 ST Board BMP280 LoRaWAN end node

Dependencies:   BME280

Temperature/Pressure LoRaWAN End Node

Revision:
60:ff7a31e79593
Parent:
56:39847849d219
Child:
61:d220d51ae9d8
--- a/main.cpp	Thu Nov 28 09:01:59 2019 +0000
+++ b/main.cpp	Thu Jul 23 11:56:52 2020 +0000
@@ -86,6 +86,7 @@
  * Application specific callbacks
  */
 static lorawan_app_callbacks_t callbacks;
+static void send_message();
 
 /**
  * Entry point for application
@@ -141,6 +142,12 @@
 
     // make your event queue dispatching events forever
     ev_queue.dispatch_forever();
+    
+ //   for(int i=0;i<5;i++)
+//    {
+//        send_message();
+//        //wait(2);
+//    }
 
     return 0;
 }
@@ -153,19 +160,19 @@
     uint16_t packet_len;
     int16_t retcode;
     int32_t sensor_value;
+    printf("send message\n");
+//
+//    if (ds1820.begin()) {
+//        ds1820.startConversion();
+//        sensor_value = ds1820.read();
+//        printf("\r\n Dummy Sensor Value = %d \r\n", sensor_value);
+//        ds1820.startConversion();
+//    } else {
+//        printf("\r\n No sensor found \r\n");
+//        return;
+//    }
 
-    if (ds1820.begin()) {
-        ds1820.startConversion();
-        sensor_value = ds1820.read();
-        printf("\r\n Dummy Sensor Value = %d \r\n", sensor_value);
-        ds1820.startConversion();
-    } else {
-        printf("\r\n No sensor found \r\n");
-        return;
-    }
-
-    packet_len = sprintf((char *) tx_buffer, "Dummy Sensor Value is %d",
-                         sensor_value);
+    packet_len = sprintf((char *) tx_buffer, "Dummy Sensor Value is");
 
     retcode = lorawan.send(MBED_CONF_LORA_APP_PORT, tx_buffer, packet_len,
                            MSG_UNCONFIRMED_FLAG);