test

Dependencies:   BLE_API mbed nRF51822

Fork of Connect_Test4 by Aura-Tech Solutions

main.cpp

Committer:
mbedAustin
Date:
2015-02-14
Revision:
1:94152e7d8b5c
Parent:
0:cd5b6733aeb1
Child:
2:e84c13abc479

File content as of revision 1:94152e7d8b5c:

#include "mbed.h"
#include "BLEDevice.h"
#include "CustomService.h"


// BLE object
BLEDevice ble;

// LED object
DigitalOut led(LED1);

const static char     DEVICE_NAME[]        = "MyDeviceName"; // change this
static const uint16_t uuid16_list[]        = {0xFF}; //Custom UUID, FF is reserved for development

// Restart advertising when phone app disconnects
void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason)
{
    ble.startAdvertising(); // restart advertising
}


int
main(void)
{
    led = 0;    // turn LED off
    ble.init(); // initialize BLE
    
    // TODO: impliment the rest of triggering for LED based on Write of characteristic.
    // TODO: impliment a read characteristic that sends text back to app
    // take a look at http://developer.mbed.org/teams/Bluetooth-Low-Energy/code/BLE_GroveColourSensor/file/000c8f8c7f03/main.cpp for inspiration.
}