7
4.
SoftwareSerial Communication
Grove - BLE can be acted as a master or slave, you can use the one via different demos.
If you are going to
use the following SoftwareSerial program, please refer to the way of connection in the previous pic. TX-
->D2, RX-->D3.
Open Arduino IDE, copy the following program and upload it onto the Arduino/Seeeduino board. And then
two BLE modules can communicate with each other.
4.1
Demo: BLE Slave
#include <SoftwareSerial.h>
//Software Serial Port
#define RxD 2
#define TxD 3
#define DEBUG_ENABLED 1
SoftwareSerial BLE
(
RxD
,
TxD
);
void
setup
()
{
Serial
.
begin
(
9600
);
pinMode
(
RxD
,
INPUT
);