JY-MCU Arduino Bluetooth Wireless Serial Port Module: Difference between revisions

From air
Jump to navigation Jump to search
No edit summary
No edit summary
Line 10: Line 10:
* Then on the PC, connect to a new Bluetooth device, use the same PIN number as above, make note of which serial (COM) port it maps to and then use Putty (Windows) or screen (Linux) to test!
* Then on the PC, connect to a new Bluetooth device, use the same PIN number as above, make note of which serial (COM) port it maps to and then use Putty (Windows) or screen (Linux) to test!


Read the forums (http://club.dx.com/forums/Forums.dx/threadid.1166641
Read the forums http://club.dx.com/forums/Forums.dx/threadid.1166641


<pre>
// @from http://club.dx.com/forums/Forums.dx/threadid.1166641
// @see http://arduino.cc/en/Reference/SoftwareSerial

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup()
{
Serial.begin(9600);
Serial.println("Goodnight moon!");
//mySerial.begin(115200);
mySerial.begin(9600);


delay(1000);
mySerial.print("AT");
delay(1000);
mySerial.print("AT+VERSION");
delay(1000);
mySerial.print("AT+PIN1342"); // Set pin to 1342
delay(1000);
mySerial.print("AT+NAMEFresaBT"); // Set the name to FresaBT
delay(1000);
//mySerial.print("AT+BAUD8"); // Set baudrate to 115200
mySerial.print("AT+BAUD4"); // Set baudrate to 9600
delay(1000);
}

void loop() // run over and over
{
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}
</pre>

Revision as of 13:30, 3 October 2012

JY-MCU Arduino Bluetooth Wireless Serial Port Module


VCC 3.6V - 6V


  • To initlalize the BT module, send it the following AT commands: AT+PIN1234 <cr> AT+NAMEdongle <cr> AT+BAUD4 <cr>. The last command will set the baud rate to 9600.
  • Then on the PC, connect to a new Bluetooth device, use the same PIN number as above, make note of which serial (COM) port it maps to and then use Putty (Windows) or screen (Linux) to test!

Read the forums http://club.dx.com/forums/Forums.dx/threadid.1166641


// @from http://club.dx.com/forums/Forums.dx/threadid.1166641
// @see http://arduino.cc/en/Reference/SoftwareSerial

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup()
{
Serial.begin(9600);
Serial.println("Goodnight moon!");
//mySerial.begin(115200);
mySerial.begin(9600);


delay(1000);
mySerial.print("AT");
delay(1000);
mySerial.print("AT+VERSION");
delay(1000);
mySerial.print("AT+PIN1342"); // Set pin to 1342
delay(1000);
mySerial.print("AT+NAMEFresaBT"); // Set the name to FresaBT
delay(1000);
//mySerial.print("AT+BAUD8"); // Set baudrate to 115200
mySerial.print("AT+BAUD4"); // Set baudrate to 9600
delay(1000);
}

void loop() // run over and over
{
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}