Temperature reading using NUCLEO-L152RE microcontroller and Grove – Temperature&Humidity Sensor Pro.

Dependencies:   DHT LMiC SX1276Lib mbed

Fork of LoRaWAN_send_text by Thomas Amberg

Revision:
10:576f275cfc14
Parent:
9:fdd150f9db9e
Child:
11:0cc0f7b84c72
--- a/main.cpp	Wed Sep 16 07:53:43 2015 +0000
+++ b/main.cpp	Wed Sep 16 23:28:25 2015 +0000
@@ -9,7 +9,7 @@
 #define LORAWAN_ADR_ON 1
 #define LORAWAN_CONFIRMED_MSG_ON 1
 #define LORAWAN_APP_PORT 15
-#define LORAWAN_APP_DATA_SIZE 1 // 32 // max 51
+#define LORAWAN_APP_DATA_SIZE 32 // max 51
 
 static uint8_t NwkSKey[] = {
     0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
@@ -30,7 +30,9 @@
 void os_getDevKey (uint8_t *buf) {} // ignore
 
 void onSendFrame (osjob_t* j) {
-    LMIC.frame[0] = n++; // or any other payload
+    for (int i = 0; i < LORAWAN_APP_DATA_SIZE; i++) {
+        LMIC.frame[i] = n++; // or any other payload
+    }
     int result = LMIC_setTxData2(LORAWAN_APP_PORT, LMIC.frame, 
         LORAWAN_APP_DATA_SIZE, LORAWAN_CONFIRMED_MSG_ON); // calls onEvent()
 }
@@ -44,7 +46,7 @@
 }
 
 void onEvent (ev_t ev) { // called by lmic.cpp, see also oslmic.h
-    debug_event(ev);
+    //debug_event(ev);
     if (ev == EV_TXCOMPLETE) {
         os_setCallback(&sendFrameJob, onSendFrame);
     }