Basic Working Code

Dependencies:   BLE_API mbed nRF51822

Fork of BLE_GATT_Example by Bluetooth Low Energy

Files at this revision

API Documentation at this revision

Comitter:
ipv1
Date:
Wed Mar 08 19:56:24 2017 +0000
Parent:
22:406127954d1f
Commit message:
working simple code;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 406127954d1f -r 1872b009ccd0 main.cpp
--- a/main.cpp	Mon Nov 09 17:08:47 2015 +0000
+++ b/main.cpp	Wed Mar 08 19:56:24 2017 +0000
@@ -1,7 +1,9 @@
 #include "mbed.h"
 #include "ble/BLE.h"
 
-DigitalOut led(LED1, 1);
+DigitalOut col0(P0_7, 0);
+
+DigitalOut led(P0_14, 1);
 uint16_t customServiceUUID  = 0xA000;
 uint16_t readCharUUID       = 0xA001;
 uint16_t writeCharUUID      = 0xA002;
@@ -38,7 +40,8 @@
     if(params->handle == writeChar.getValueHandle()) {
         /* toggle LED if only 1 byte is written */
         if(params->len == 1) {
-            led = params->data[0];
+            //led = params->data[0];
+            led=!led;
             (params->data[0] == 0x00) ? printf("led on\n\r") : printf("led off\n\r"); // print led toggle
         }
         /* Print the data if more than 1 byte is written */