Run on TY51822r3 board with ACC sensor (LIS3DH or BMC050)
Dependencies: BLE_API LIS3DH mbed nRF51822 BMC050 nRF51_LowPwr nRF51_Vdd
Fork of BLE_EddystoneBeacon_Service by
Diff: main.cpp
- Revision:
- 31:bdd03742096a
- Parent:
- 30:6c2db8bf5b17
- Child:
- 32:41840b78597e
diff -r 6c2db8bf5b17 -r bdd03742096a main.cpp --- a/main.cpp Fri Jul 24 04:07:34 2015 +0000 +++ b/main.cpp Tue Aug 11 18:13:46 2015 +0000 @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2015 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,14 +15,14 @@ */ #include "mbed.h" -#include "BLE.h" -#include "Eddystone.h" +#include "ble/BLE.h" +#include "ble/services/EddystoneService.h" BLE ble; uint8_t UIDnamespace[] = {0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xAA}; // 10Bytes for Namespace UUID uint8_t UIDinstance[] = {0xbb,0xcc,0xdd,0xee,0xff,0x00}; // 6Bytes for Instance UUID char Url[] = "http://www.mbed.org"; -int8_t txPower = -18; +int8_t txPower = -40; uint16_t beaconPeriodus = 1000; //Callbacks for temperature / battery updates @@ -31,15 +31,15 @@ int battery = 0; int temp = 0; -// Start the Eddystone beacon here +// Add Eddystone service to BLE device, can pass NULL for UID and URL parameters to disable those frames EddystoneService eddyBeacon(ble, beaconPeriodus, txPower ,UIDnamespace, UIDinstance, Url, sizeof(Url)); -// Function to update beacon battery voltage +// Optional Function to update Eddystone beacon TLM frame battery voltage void tlmBatteryCallback(void){ eddyBeacon.updateTlmBatteryVoltage(battery++); } -// Function to update Beacon Temperature +// Optional Function to update Eddystone beacon TLM frame temperature void tlmTemperatureCallback(void){ eddyBeacon.updateTlmBeaconTemp(temp++); }