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@2:c610e1a7fbcd, 2014-09-11 (annotated)
- Committer:
- 9uS7
- Date:
- Thu Sep 11 15:09:05 2014 +0000
- Revision:
- 2:c610e1a7fbcd
- Parent:
- 1:e1cfb5850088
- Child:
- 3:12e1f116ea42
made motorSetup
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 | 2:c610e1a7fbcd | 3 | #include "control.h" |
| 9uS7 | 0:4f07ba929908 | 4 | |
| 9uS7 | 1:e1cfb5850088 | 5 | Serial bt(p13, p14); // tx, rx |
| 9uS7 | 0:4f07ba929908 | 6 | |
| 9uS7 | 1:e1cfb5850088 | 7 | void btSetup(int role) |
| 9uS7 | 0:4f07ba929908 | 8 | { |
| 9uS7 | 1:e1cfb5850088 | 9 | if( role==BT_MASTER ){ |
| 9uS7 | 1:e1cfb5850088 | 10 | //if this device is the master |
| 9uS7 | 1:e1cfb5850088 | 11 | bt.baud(9600); |
| 9uS7 | 1:e1cfb5850088 | 12 | bt.printf("$$$"); |
| 9uS7 | 1:e1cfb5850088 | 13 | wait(0.5); |
| 9uS7 | 1:e1cfb5850088 | 14 | bt.printf("C\r"); |
| 9uS7 | 1:e1cfb5850088 | 15 | wait(0.5); |
| 9uS7 | 1:e1cfb5850088 | 16 | } |
| 9uS7 | 1:e1cfb5850088 | 17 | else{ |
| 9uS7 | 1:e1cfb5850088 | 18 | //if this device is the slave |
| 9uS7 | 1:e1cfb5850088 | 19 | ; //nothing to do |
| 9uS7 | 2:c610e1a7fbcd | 20 | } |
| 9uS7 | 2:c610e1a7fbcd | 21 | /* |
| 9uS7 | 2:c610e1a7fbcd | 22 | void btLoop(int role) |
| 9uS7 | 2:c610e1a7fbcd | 23 | { |
| 9uS7 | 2:c610e1a7fbcd | 24 | if( role==BT_MASATER ){ |
| 9uS7 | 2:c610e1a7fbcd | 25 | //if this device is the master |
| 9uS7 | 2:c610e1a7fbcd | 26 | |
| 9uS7 | 1:e1cfb5850088 | 27 | } |
| 9uS7 | 2:c610e1a7fbcd | 28 | else{ |
| 9uS7 | 2:c610e1a7fbcd | 29 | //if this device is the slave |
| 9uS7 | 2:c610e1a7fbcd | 30 | |
| 9uS7 | 2:c610e1a7fbcd | 31 | } |
| 9uS7 | 2:c610e1a7fbcd | 32 | } |
| 9uS7 | 2:c610e1a7fbcd | 33 | */ |
