This project contains two type of beacons: Eddystone and iBeacon.

Dependencies:   microbit-iBeacon

Fork of BTW_ComboBeacon_Solution by KEN OGAMI

Committer:
krenbluetoothsig
Date:
Thu Aug 02 01:13:03 2018 +0000
Revision:
19:8c3dd0a6a0a1
Parent:
18:eeea3e01140c
Child:
21:8d35c362b325
1. NEW: add ; //**@code; //**@endcode; as the indicator for code snippet.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
krenbluetoothsig 17:6715daf92c78 1 #include "MicroBit.h"
krenbluetoothsig 17:6715daf92c78 2
krenbluetoothsig 17:6715daf92c78 3 /******************************************************
krenbluetoothsig 17:6715daf92c78 4 * Macros
krenbluetoothsig 17:6715daf92c78 5 ******************************************************/
krenbluetoothsig 17:6715daf92c78 6 // TODO: add ADV on and off flag
krenbluetoothsig 18:eeea3e01140c 7
krenbluetoothsig 17:6715daf92c78 8
krenbluetoothsig 17:6715daf92c78 9 /******************************************************
krenbluetoothsig 17:6715daf92c78 10 * Constants
krenbluetoothsig 17:6715daf92c78 11 ******************************************************/
krenbluetoothsig 17:6715daf92c78 12 // TODO: constants, used for iBeacon UUID(MSB first), Major, Minor and txpower setting
krenbluetoothsig 17:6715daf92c78 13
krenbluetoothsig 17:6715daf92c78 14
krenbluetoothsig 17:6715daf92c78 15 /******************************************************
krenbluetoothsig 17:6715daf92c78 16 * Variables
krenbluetoothsig 17:6715daf92c78 17 ******************************************************/
krenbluetoothsig 17:6715daf92c78 18 //microbit object
krenbluetoothsig 17:6715daf92c78 19 MicroBit uBit;
krenbluetoothsig 17:6715daf92c78 20 //Initial USB-to-Serial, baud rate is 9600-8-N-1
krenbluetoothsig 17:6715daf92c78 21 Serial pcCom(USBTX, USBRX);
krenbluetoothsig 17:6715daf92c78 22
krenbluetoothsig 17:6715daf92c78 23 // TODO: global data and functions
krenbluetoothsig 17:6715daf92c78 24
krenbluetoothsig 17:6715daf92c78 25
krenbluetoothsig 17:6715daf92c78 26
krenbluetoothsig 17:6715daf92c78 27 /******************************************************
krenbluetoothsig 17:6715daf92c78 28 * Functions
krenbluetoothsig 17:6715daf92c78 29 ******************************************************/
krenbluetoothsig 17:6715daf92c78 30 // TODO: functions, startAdvertising and stopAdvertising
krenbluetoothsig 17:6715daf92c78 31
krenbluetoothsig 17:6715daf92c78 32
krenbluetoothsig 17:6715daf92c78 33 // TODO: functions, used for ButtonA and ButtonB interrupt callbacks
krenbluetoothsig 17:6715daf92c78 34
krenbluetoothsig 17:6715daf92c78 35
krenbluetoothsig 17:6715daf92c78 36 int main()
krenbluetoothsig 17:6715daf92c78 37 {
krenbluetoothsig 17:6715daf92c78 38 // Serial output after a reset
krenbluetoothsig 17:6715daf92c78 39 pcCom.printf("mBit Beacon.\n\r");
krenbluetoothsig 17:6715daf92c78 40
krenbluetoothsig 17:6715daf92c78 41 // Initialize the micro:bit runtime.
krenbluetoothsig 17:6715daf92c78 42 uBit.init();
krenbluetoothsig 17:6715daf92c78 43
krenbluetoothsig 17:6715daf92c78 44 // TODO: Register the interrupt and callback for ButtonA and ButtonB
krenbluetoothsig 18:eeea3e01140c 45
krenbluetoothsig 17:6715daf92c78 46
krenbluetoothsig 19:8c3dd0a6a0a1 47 // TODO: First Advertisment, adv name only
krenbluetoothsig 18:eeea3e01140c 48
krenbluetoothsig 17:6715daf92c78 49
krenbluetoothsig 17:6715daf92c78 50 release_fiber();
krenbluetoothsig 17:6715daf92c78 51 }