9
pinMode
(
RxD
,
INPUT
);
pinMode
(
TxD
,
OUTPUT
);
setupBleConnection
();
}
void
loop
()
{
char
recvChar
;
while
(
1
){
if
(
BLE
.
available
()){
//check if there's any data sent from the
remote BLE
recvChar
=
BLE
.
read
();
Serial
.
(
recvChar
);
}
if
(
Serial
.
available
()){
//check if there's any data sent from the
local serial terminal, you can add the other applications here
recvChar
=
Serial
.
read
();
BLE
.
(
recvChar
);
}
}
}
void
setupBleConnection
()
{
BLE
.
begin
(
9600
);
//Set BLE BaudRate to default baud rate 9600
BLE
.
(
"AT+CLEAR"
);
//clear all previous setting
BLE
.
(
"AT+ROLE1"
);
//set the bluetooth name as a master
BLE
.
(
"AT+SAVE1"
);
//don't save the connect information
}