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:
4:f83ad3eee79d
Parent:
3:ce28e3313a88
Child:
5:1f8829bd11ed
--- a/main.cpp	Thu Apr 16 20:00:01 2015 +0000
+++ b/main.cpp	Sun Sep 13 10:26:09 2015 +0000
@@ -33,7 +33,7 @@
 /*!
  * Defines the device address when using personalization activation procedure
  */
-#define LORAWAN_DEV_ADDR                            ( uint32_t )0x12345678
+#define LORAWAN_DEV_ADDR                            ( uint32_t )0x00001056//0x12345678
 
 #endif
 
@@ -82,7 +82,8 @@
 // unique device ID (LSBF)
 static const u1_t DevEui[8] =
 {
-    0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF
+//    0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF
+    0xF0, 0x3D, 0x29, 0x10, 0x00, 0x00, 0x10, 0x56
 };
 
 // device-specific AES key (derived from device EUI)
@@ -96,15 +97,19 @@
 // network session key
 static uint8_t NwkSKey[] = 
 { 
-    0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
-    0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
+//    0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
+//    0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
+    0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
+    0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
 };
 
 // application session key
 static uint8_t ArtSKey[] = 
 { 
-    0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
-    0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
+//    0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
+//    0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
+    0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
+    0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
 };
 
 #endif
@@ -139,18 +144,21 @@
 // provide application router ID (8 bytes, LSBF)
 void os_getArtEui( uint8_t *buf )
 {
+    debug_str("os_getArtEui\r\n");
     memcpy( buf, AppEui, 8 );
 }
 
 // provide device ID (8 bytes, LSBF)
 void os_getDevEui( uint8_t *buf )
 {
+    debug_str("os_getDevEui\r\n");
     memcpy( buf, DevEui, 8 );
 }
 
 // provide device key (16 bytes)
 void os_getDevKey( uint8_t *buf )
 {
+    debug_str("os_getDevKey\r\n");
     memcpy( buf, DevKey, 16 );
 }
 
@@ -170,6 +178,7 @@
 
 static void prepareTxFrame( void )
 {
+    debug_str("prepareTxFrame\r\n");
     LMIC.frame[0] = AppLedStateOn;
 #if ( LORAWAN_CONFIRMED_MSG_ON == 1 )
     LMIC.frame[1] = LMIC.seqnoDn >> 8;
@@ -182,6 +191,7 @@
 
 void processRxFrame( void )
 {
+    debug_str("processRxFrame\r\n");
     switch( LMIC.frame[LMIC.dataBeg - 1] ) // Check Rx port number
     {
         case 1: // The application LED can be controlled on port 1 or 2
@@ -199,6 +209,7 @@
 
 static void onSendFrame( osjob_t* j )
 {
+    debug_str("onSendFrame\r\n");
     prepareTxFrame( );
     LMIC_setTxData2( LORAWAN_APP_PORT, LMIC.frame, LORAWAN_APP_DATA_SIZE, LORAWAN_CONFIRMED_MSG_ON );
 
@@ -210,6 +221,7 @@
 // Initialization job
 static void onInit( osjob_t* j )
 {
+    debug_str("onInit\r\n");
     // reset MAC state
     LMIC_reset( );
     LMIC_setAdrMode( LORAWAN_ADR_ON );
@@ -227,6 +239,7 @@
 
 int main( void )
 {
+    debug_str("main\r\n");
     osjob_t initjob;
 
     // initialize runtime env
@@ -243,6 +256,7 @@
 //////////////////////////////////////////////////
 void onEvent( ev_t ev )
 {
+    debug_str("onEvent\r\n");
     bool txOn = false;
     debug_event( ev );