This repository is for Bluetooth Asia 2018 developer training, beacon session.

Dependencies:   microbit-dal

Fork of BluetoothAsiaBeaconClass by Kaiser Ren

Files at this revision

API Documentation at this revision

Comitter:
krenbluetoothsig
Date:
Thu May 17 07:32:41 2018 +0000
Parent:
23:b4221eb36d59
Commit message:
1. CHG: when micro:bit power up, it advertises its board name; when button A is pressed, it advertises Eddystone-URL. Both of them use same txpower setting.

Changed in this revision

beacon_src.txt Show annotated file Show diff for this revision Revisions of this file
--- a/beacon_src.txt	Mon May 07 23:53:26 2018 +0000
+++ b/beacon_src.txt	Thu May 17 07:32:41 2018 +0000
@@ -1,8 +1,7 @@
-
 #include "MicroBit.h"
-
+ 
 MicroBit uBit;
-
+ 
 char URL[] = "http://www.bluetooth.com";
 
 // lvl : Pwr@ 1m : Pwr@ 0m
@@ -48,17 +47,23 @@
     }
     stopAdvertising();
 }
-
+ 
+ 
+ 
 int main()
 {
     // Initialise the micro:bit runtime.
     uBit.init();
+    uBit.bleManager.setTransmitPower(tx_power_level);
+    uBit.bleManager.advertise();
+    uBit.display.scroll("ON");
 
     uBit.messageBus.listen(MICROBIT_ID_BUTTON_A, MICROBIT_BUTTON_EVT_CLICK, onButtonA);
     uBit.messageBus.listen(MICROBIT_ID_BUTTON_B, MICROBIT_BUTTON_EVT_CLICK, onButtonB);
     
-    startAdvertising();
+    //startAdvertising();
     
     release_fiber();
+  
 }
-
+ 
\ No newline at end of file