Intercommunication between Two Microduino-BT Modules

From Microduino Wiki
Revision as of 02:44, 6 January 2015 by 1304410487@qq.com (talk) (Created page with "{| style="width: 800px;" |- | *Step 1: Two BT modules match the connection. **Please refer to: Connection Method for New Version *Step 2: The default is the soft serial...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  • Step 2:

The default is the soft serial port (D4, D5). Here we introduce the connection method of the default serial port. If you want to change jumpers, you need to change program of the serial port correspondingly. Note: Baud rate should be below 38400.

  • If using serial1 (D2, D3):
    • If using Core to debug, please change “SoftwareSerial mySerial(4, 5)” to “SoftwareSerial mySerial(2, 3)”;
    • If using Core+ to debug, please change program “mySerial” to “Serial1”. (D2, D3) corresponds to Serial 1 of Core+.
#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());
  }
}
Download the program to the core board and you can send data through serial port input.
Microduino-BLE-send-1.jpg
Microduino-BLE-send-2.jpg

Note: After connection, AT instruction doesn’t work.

Microduino-BLE-send-3.jpg