Connection Method for New Version
You need to open Arduino IDE serial monitor or downloaded CommAssistant and set up as follows: Baud rate: 9600; Data bit: 8; Stop bit: 1; Check bit: None. Besides, please make sure AT instruction ended with new line, 0x0D 0x0A and “\r\n”.
Select a module as the slave machine and connect the wire according to pin. Open the serial monitor, select 9600 baud rate and “Both NL & CR” and input “AT” in the serial data sending box and enter. If the return is “OK”, it means the serial communication of the module has no problem.
Since the BT is the slave machine by default, you need to charge it with other power supply device and wait for the connection of the host machine.
Open the serial monitor, select baud rate 9600 and “Both NL & CR” and input “AT” in the serial port data sending box. If the return is “ok”, it means the serial communication of the module is fine. Change the mode of the host machine, input “AT+ROLE1” in the serial port data sending box. If the return shows “OK+Set:1 Hello World Central”, then the host machine setup is successful. Set power-on connection mode, input “AT+IMME1” in the serial port data sending box. If the return show “OK+Set:1 Hello World Central”, it means the setup is successful. Search slave machine device, input “AT+DISC?” in the serial data sending box and go back to your slave machine BT MAC address. Connect the slave machine, input “AT+COND05FB800D68D” in the serial data sending box and have the connection with the slave machine. If the connection goes well, the slave machine will output “Connected” and the host machine will show “Connected” after about 23 seconds after updating parameters, meaning the BT connection is successful and the system enters transmission mode. |
Power off the slave machine and set power-on connection mode for host machine. Enter “AT+IMME1” in serial data sending box and when it returns to “OK+Set:1 Hello World Central”, it means the setup is successful. This, it can be connected even when powers off.
You can also control AT instruction via core if you think dupont line connection is boring.
- Here we adopt D4, D5 serial port to debug.
Program:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(4, 5); // RX, TX
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
}
void loop() // run over and over
{
if(Serial.available())
{
mySerial.write(Serial.read());
}
if(mySerial.available())
{
Serial.write(mySerial.read());
}
}
You can connect according to steps above after the program download. |}