Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: libmDot-mbed5 DOGS102 ISL29011 MMA845x MPL3115A2 NCP5623B X_NUCLEO_IKS01A1 Senet_Packet
Fork of MTDOT-UDKDemo_Senet by
Diff: main.cpp
- Revision:
- 19:62f4a6bae943
- Parent:
- 18:856ebfac428b
- Child:
- 21:12d2527f0437
- Child:
- 22:d3a56f5a949c
--- a/main.cpp Wed Aug 24 15:16:49 2016 -0400
+++ b/main.cpp Wed Aug 24 22:04:46 2016 -0400
@@ -64,9 +64,7 @@
#define FAST_SEND_PERIOD 1
// Send frame period
-#define SEND_PERIOD 12
-
-
+#define SEND_PERIOD 10
#endif
@@ -136,7 +134,7 @@
* LoRaWAN Configuration
*/
static uint8_t app_id[8] = {0x00,0x25,0x0C,0x00,0x00,0x01,0x00,0x01};
-static uint8_t app_key[16] = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F};
+static uint8_t app_key[16] = {0x9F,0x93,0xDC,0xEB,0xAC,0x2F,0x4F,0xEE,0x80,0x3C,0x05,0x7A,0x54,0x8E,0x44,0x99};
static std::vector<uint8_t> config_app_id(app_id,app_id+sizeof(app_id)/sizeof(uint8_t));
static std::vector<uint8_t> config_app_key(app_key,app_key+sizeof(app_key)/sizeof(uint8_t));
static uint8_t config_frequency_sub_band = 0;
@@ -192,6 +190,17 @@
mDot* mdot_radio;
bool exit_program = false;
Ticker joinTicker;
+DigitalOut APP_LED(PA_0);
+
+// join status
+#define JOIN_LED APP_LED
+
+// server sync status
+#define SYNC_LED APP_LED
+
+#define SYNC_LED_OK 0 // synced
+#define SYNC_LED_OOS 1 // out of sync
+
/*
* Process downlink
@@ -242,6 +251,8 @@
if(reflected_value == position_value)
{
evbBackLight->setLEDCurrent(16);
+ // Set LED to indicate server in agreement
+ SYNC_LED=SYNC_LED_OK;
}
else
{
@@ -448,8 +459,12 @@
position_value= 0x00;
}
- if(position_changed)
+ if(position_changed){
evbBackLight->setLEDCurrent(0);
+ // Turn LED off to indicate server not in agreement
+ SYNC_LED=SYNC_LED_OOS;
+ }
+
/*
* Trigger a Pressure reading
*/
@@ -675,6 +690,8 @@
if(value == position_value)
{
reflected_value = value;
+ // Turn LED on to indicate server in agreement
+ SYNC_LED=SYNC_LED_OK;
}
}
}
@@ -769,6 +786,9 @@
{
position_value = next_value;
position_changed = true;
+
+ // Turn LED off to indicate server is not in agreement
+ SYNC_LED=SYNC_LED_OOS;
}
}
@@ -815,11 +835,9 @@
#error Board type not defined!
#endif
-DigitalOut joinLED(PA_0);
-
void joinLedToggle()
{
- joinLED = !joinLED;
+ JOIN_LED = !JOIN_LED;
}
void mDotConfigureAndJoin()
@@ -940,7 +958,7 @@
printf("network joined\r\n");
joinTicker.detach();
- joinLED=1;
+ JOIN_LED=1;
}
