Locator beacon firmware
Dependencies: BLE_API mbed nRF51822
Fork of WeatherStation by
Diff: main.cpp
- Revision:
- 8:2aa1fc734e13
- Parent:
- 7:8fa805941074
- Child:
- 9:dd7ba1fdae47
diff -r 8fa805941074 -r 2aa1fc734e13 main.cpp --- a/main.cpp Sat Apr 29 15:02:20 2017 +0000 +++ b/main.cpp Sat Apr 29 15:43:33 2017 +0000 @@ -1,6 +1,4 @@ -#define I2C_SDA p3 -#define I2C_SCL p4 -#define BAT_SENSE p1 + #include "mbed.h" #include "BLE.h" @@ -9,13 +7,12 @@ BLE ble; -AnalogIn battery(BAT_SENSE); + -const static char DEVICE_NAME[] = "Locator"; +const static char DEVICE_NAME[] = "Locator RedBear"; static const uint16_t serviceList[] = { - GattService::UUID_BATTERY_SERVICE, 0x1821 }; @@ -41,10 +38,11 @@ ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t *)serviceList, sizeof(serviceList)); ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME)); ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); - ble.gap().setAdvertisingInterval(1000); /* 1000ms */ + ble.gap().setAdvertisingInterval(500); /* 1000ms */ ble.gap().startAdvertising(); while (true) { ble.waitForEvent(); + printf("...\n"); } }