Demo to get the die sensors value of 51822
Dependencies: BLE_API Sensors mbed nRF51822
Fork of LinkNode_DataAdvertising by
Diff: main.cpp
- Revision:
- 7:f3e587ca9139
- Parent:
- 6:b3d3351aadc6
--- a/main.cpp Mon Feb 22 08:55:35 2016 +0000 +++ b/main.cpp Wed Apr 06 08:57:58 2016 +0000 @@ -5,7 +5,8 @@ #define APP_SPECIFIC_ID_TEST 0xFEFE #pragma pack(1) -struct ApplicationData_t { +struct ApplicationData_t +{ uint16_t applicationSpecificId; /* An ID used to identify temperature value in the manufacture specific AD data field */ Sensors::tmpSensorValue_t tmpSensorValue; /* User defined application data */ @@ -14,9 +15,9 @@ BLE ble; Sensors tempSensor; -DigitalOut led(P0_20); +DigitalOut led(P0_19); static bool triggerTempValueUpdate = false; -const static char DEVICE_NAME[8] = "ls_test"; /*The size of the DEVICE_NAME[] can't change */ +const static char DEVICE_NAME[8] = "Linkaa"; /*The size of the DEVICE_NAME[] can't change */ void periodicCallback(void) { @@ -67,14 +68,14 @@ int main(void) { Ticker ticker; - /* Enable trigger every 2 seconds */ - ticker.attach(periodicCallback, 2); - + ticker.attach(periodicCallback, 0.3); ble.init(); /* Start data advertising */ temperatureValueAdvertising(); - while (true) { + while (true) + { + if (triggerTempValueUpdate) { /* Update data value */