Demo to get the die sensors value of 51822
Dependencies: BLE_API Sensors mbed nRF51822
Fork of LinkNode_DataAdvertising by
Revision 7:f3e587ca9139, committed 2016-04-06
- Comitter:
- helloqi
- Date:
- Wed Apr 06 08:57:58 2016 +0000
- Parent:
- 6:b3d3351aadc6
- Commit message:
- change the name
Changed in this revision
Sensors.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b3d3351aadc6 -r f3e587ca9139 Sensors.lib --- a/Sensors.lib Mon Feb 22 08:55:35 2016 +0000 +++ b/Sensors.lib Wed Apr 06 08:57:58 2016 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/helloqi/code/Sensors/#ee98296289d0 +https://developer.mbed.org/users/helloqi/code/Sensors/#29171beb6b8c
diff -r b3d3351aadc6 -r f3e587ca9139 main.cpp --- 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 */