Hardware Serial port Rx and TX should not use directly connect.So,I want to use software Serial Pin.
How sholud I do?I want to connect with Bluetooth HC-06 moudule to send a command over the bluetooth to control associated material attached with arduino uno.Please help me how to connect as a software serial code to send control message.
Have you looked at the SoftwareSerial examples in the IDE ?
Basically you define the Tx and Rx pins to be used, the name to use with SoftwareSerial, connect your device to the defined pins then print to the name you chose when creating the instance of SoftwareSerial.
Yes, I already seen that post.But the bit transfer rate between software serial and Hardware does not synchronous.It is very important facts to communicate.If you have another good idea,please advice me.
the bit transfer rate between software serial and Hardware does not synchronous.
Can you please explain what you mean by this ? What devices have you got connected to which pins ?
syommh:
Yes, I already seen that post.But the bit transfer rate between software serial and Hardware does not synchronous.
What baud rate do you need to use for your Bluetooth device? You can select different baud rates in SoftwareSerial.
Post the code you have been trying.
...R
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerial.println("Hello, world?");
}
void loop() // run over and over
{
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(mySerial.read());
}
This is the code that I used.I use serial monitoring in my my phone Bluestick.Firstly I run the code;Serial function do work but Software serial function does not.So,I try the to adjust the buad rate for that from PC serial monitor to Phone SOtware serial monitor.
syommh:
Hardware Serial port Rx and TX should not use directly connect.So,I want to use software Serial Pin.
This is nonsense, and I wonder what you think hardware serial is for.
You might find the following background notes useful
http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf
http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino
syommh:
This is the code that I used.I use serial monitoring in my my phone Bluestick.Firstly I run the code;Serial function do work but Software serial function does not.So,I try the to adjust the buad rate for that from PC serial monitor to Phone SOtware serial monitor.
What do you mean by "Serial function do work" - how do you know? please describe what happens.
What do you mean by "Software serial function does not" - what tests are you carrying out? What do you expect to happen? what does happen?
Is the Bluetooth device properly paired with your phone?
...R