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: microbit-iBeacon
Fork of BTW_ComboBeacon_Solution by
main.cpp@21:8d35c362b325, 2018-08-02 (annotated)
- Committer:
- krenbluetoothsig
- Date:
- Thu Aug 02 14:40:17 2018 +0000
- Revision:
- 21:8d35c362b325
- Parent:
- 19:8c3dd0a6a0a1
1. CHG: minor change for code retract.
Who changed what in which revision?
| User | Revision | Line number | New 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 | 21:8d35c362b325 | 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 | 21:8d35c362b325 | 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 | } |
