Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API mbed nRF51822
Diff: main.cpp
- Revision:
- 6:1d7e5fcc8d00
- Parent:
- 5:b3f8e10b9602
- Child:
- 9:0ed64b14d46b
diff -r b3f8e10b9602 -r 1d7e5fcc8d00 main.cpp
--- a/main.cpp Tue Feb 17 17:11:18 2015 +0000
+++ b/main.cpp Tue Feb 24 14:53:04 2015 +0000
@@ -5,7 +5,6 @@
#include "mbed.h"
#include "BLEDevice.h"
-#include "CarCommsService.h"
#include "BroadcasterService.h"
#include <string>
@@ -29,15 +28,12 @@
void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason)
{
pc.printf("Disconnected! - start advertising. Handle:%d, Reason:0x%02x\r\n", handle, reason);
- connected=false;
ble.startAdvertising();
}
void connectionCallback(Gap::Handle_t handle, Gap::addr_type_t peerAddrType, const Gap::address_t peerAddr, const Gap::ConnectionParams_t *parms)
{
pc.printf("Connected! - stop advertising. Handle:%d, eType:%d, Add:%u.\r\n", handle, peerAddrType, peerAddr);
-
- connected = true;
ble.stopAdvertising();
}
@@ -47,15 +43,13 @@
uint8_t command[8] = { 0x4d,0x32,0x81,0xc0,0x4d,0x32,0x81,0xc0 };
//with first 4 bits being type code, and last 4 being command, or something
- uint8_t testCommand = 0x12; //max value is 255
-
uint8_t cmdOn = 0x01;
uint8_t cmdOff = 0x02;
//blinky
led1 = 1;
Ticker t;
- t.attach(blink, 1.0f);
+ t.attach(blink, 5.0f);
//Create BLE stuff
ble.init();
@@ -63,7 +57,7 @@
ble.onConnection(connectionCallback);
//CarCommsService commsService(ble, cmd);
- BroadcasterService broadcasterService(ble, testCommand);
+ BroadcasterService broadcasterService(ble, cmdOff);
/*
**BREDR_NOT_SUPPORTED = BLE only