Software Serial problem

Hi, I am using a Bluetooth Hc-06 to communicate arduino and android. I have noticed that i can not keep the bluetooth connected (digital pins 0 and 1) and upload a sketch at the same time, also Ive heard that i can use another digital pins as software serial to connect the bluetooth so i can upload sketchs into arduino without disconnect the bluetooth, its a little annoying. Does someone knows how to do that?


Sure, you go to the Arduino reference page on this site, and look for Software Serial. It's hidden under the "Learning" tab.

Hi, I try to use this code that i saw as en example but it did not work (i think), i only see "Goodnight moon!".

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(; if (Serial.available()) mySerial.write(; }

Okay, what did you connect to pins 10, 11 that would receive "Goodnight, moon!"?

SoftwareSerial mySerial (10,11)//RX,TX
I have connected the TX from BT HC-06 to pin 10 and RX from BT Hc-06 to 11 pin and the other 2 cables to its respective GND and 5v.

i think the “hello world” should have be printed on the monitor too.

I only want to work with the BT turned on and upload sketches as well

Don't use SoftwareSerial. Instead, use AltSoftSerial on pins 8 & 9. It's much more efficient and reliable.