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
Diff: bluetooth.cpp
- Revision:
- 1:e1cfb5850088
- Parent:
- 0:4f07ba929908
- Child:
- 2:c610e1a7fbcd
--- a/bluetooth.cpp Thu Sep 11 10:15:34 2014 +0000
+++ b/bluetooth.cpp Thu Sep 11 14:42:49 2014 +0000
@@ -1,16 +1,20 @@
#include "mbed.h"
#include "bluetooth.h"
+Serial bt(p13, p14); // tx, rx
-void btSetupMaster(void) //setup master
+void btSetup(int role)
{
- btMaster.baud(9600);
- btMaster.printf("$$$");
- wait(0.5);
- btMaster.printf("C\r");
- wait(0.5);
-}
-
-void btSetupSlave(void)
-{
+ if( role==BT_MASTER ){
+ //if this device is the master
+ bt.baud(9600);
+ bt.printf("$$$");
+ wait(0.5);
+ bt.printf("C\r");
+ wait(0.5);
+ }
+ else{
+ //if this device is the slave
+ ; //nothing to do
+ }
}
\ No newline at end of file
