0

I have connected a RN-42 bluetooth (TX-D0, RX-D1, VCC-5V, GND_GND) to arduino.The problem is that when I run this code ,nothing happens it just upload to infinite or it doesn't. I am checking with tera term. Is there a problem with the connection of the pins? Also when I pair my android phone to the bluetooth it says paired on the phone but the blue light of the bluetooth doesn't switch on, like it's not connected.

 #include <SoftwareSerial.h>// import the serial library
 SoftwareSerial Genotronex(1, 0); // TX,RX
 int ledpin=13; // led on D13 will show blink on / off
 int BluetoothData; // the data given from Computer
 void setup() {
 // put your setup code here, to run once:
 Genotronex.begin(9600);
 Genotronex.println("Bluetooth On please press 1 or 0 blink LED ..");
 pinMode(ledpin,OUTPUT);
 }
 void loop() {
 // put your main code here, to run repeatedly:
 if (Genotronex.available()){
 BluetoothData=Genotronex.read();
 if(BluetoothData=='1'){ // if number 1 pressed ....
 digitalWrite(ledpin,1);
 Genotronex.println("LED On D13 ON ! ");
 }
 if (BluetoothData=='0'){// if number 0 pressed ....
 digitalWrite(ledpin,0);
 Genotronex.println("LED On D13 Off ! ");
 }
}
 delay(100);// prepare for next data ...
 }
user3704293
4717 silver badges19 bronze badges
asked Jul 31, 2015 at 8:24
3
  • 1
    There is no need to use software serial on the hardware UART, the D0 and D1 pins are for communication with the PC, in line with what Owen answered try his suggestion. Commented Aug 4, 2015 at 7:32
  • Are you sure that the bluetooth module is already connected/paired correctly? Is your bluetooth module in master or slave mode? Commented Sep 27, 2015 at 15:23
  • VCC to 3.3V? sparkfun.com/datasheets/Wireless/Bluetooth/rn-42-ds.pdf Commented Jan 27, 2016 at 22:55

4 Answers 4

1

As commenter by RSM

The issue you are facing is because you are using pins 0 and 1

These are used by the arduino for uart.

So for starters please use any pin other that 0 and 1. But if you insist that you do need to use these pins, then you don't need softwareserial you can use the default serial itself, but you will need to disconnect the bluetooth while programming.

answered Aug 28, 2015 at 10:52
0

If you use RX, and TX in default pin then it is not necessary that you should include SoftwareSerial library.

answered Oct 28, 2015 at 13:53
0

The simplest solution to this is to just unplug the Bluetooth module from the TX and RX ports and click to upload. Your sketch will be uploaded and you can plug the pins back. For a permanent solution use the digital pins aside 1 and 0 because they are the same pins your computer uses to upload your sketch to the Arduino board.

answered Jan 27, 2016 at 20:57
-1

Try taking off the bluetooth module, this will allow communication with the computer, not the bluetooth module. I had the same problems with my hc-06, and have not solved the ladder yet.

answered Aug 1, 2015 at 16:17

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.