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: MODSERIAL mbed-rtos mbed
Fork of Master by
bluetooth.cpp@1:e1cfb5850088, 2014-09-11 (annotated)
- Committer:
- 9uS7
- Date:
- Thu Sep 11 14:42:49 2014 +0000
- Revision:
- 1:e1cfb5850088
- Parent:
- 0:4f07ba929908
- Child:
- 2:c610e1a7fbcd
can compile
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| 9uS7 | 0:4f07ba929908 | 1 | #include "mbed.h" |
| 9uS7 | 0:4f07ba929908 | 2 | #include "bluetooth.h" |
| 9uS7 | 0:4f07ba929908 | 3 | |
| 9uS7 | 1:e1cfb5850088 | 4 | Serial bt(p13, p14); // tx, rx |
| 9uS7 | 0:4f07ba929908 | 5 | |
| 9uS7 | 1:e1cfb5850088 | 6 | void btSetup(int role) |
| 9uS7 | 0:4f07ba929908 | 7 | { |
| 9uS7 | 1:e1cfb5850088 | 8 | if( role==BT_MASTER ){ |
| 9uS7 | 1:e1cfb5850088 | 9 | //if this device is the master |
| 9uS7 | 1:e1cfb5850088 | 10 | bt.baud(9600); |
| 9uS7 | 1:e1cfb5850088 | 11 | bt.printf("$$$"); |
| 9uS7 | 1:e1cfb5850088 | 12 | wait(0.5); |
| 9uS7 | 1:e1cfb5850088 | 13 | bt.printf("C\r"); |
| 9uS7 | 1:e1cfb5850088 | 14 | wait(0.5); |
| 9uS7 | 1:e1cfb5850088 | 15 | } |
| 9uS7 | 1:e1cfb5850088 | 16 | else{ |
| 9uS7 | 1:e1cfb5850088 | 17 | //if this device is the slave |
| 9uS7 | 1:e1cfb5850088 | 18 | ; //nothing to do |
| 9uS7 | 1:e1cfb5850088 | 19 | } |
| 9uS7 | 0:4f07ba929908 | 20 | } |
